Project

srsly

0.0
No commit activity in last 3 years
No release in over 3 years
SRSLY?
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme
..............................................
..####...#####....####...##....##..##...####..
.##......##..##..##......##.....####...##..##.
..####...#####....####...##......##.......##..
.....##..##..##......##..##......##......##...
..####...##..##...####...######..##......##...
..............................................
require 'srsly'

r = SRSLY?                                  # Default "Are you sure (Y/N)?" message
r = SRSLY? nil => :eof                      # Returns :eof on EOF (nil)

r = SRSLY? 'Continue (Y/N)? '               # Custom message
r = SRSLY? 'Continue (Y/N)? ', nil => :eof  # Returns :eof on EOF

r = SRSLY? 'Seriously (Y/N/A)? ',
         # Expected responses (Regexp or String)
           /^y/i  => true,
           /^n/i  => false,
           /^a/i  => :all,
         # Other options
           :error => 'Invalid input. Seriously (Y/N/A)? ',
           :tries => 5,
           :in    => $stdin,
           :out   => $stdout

r = SRSLY? "A or B? ",
           'A'    => :a,
           'B'    => :b,
           nil    => :quit,
           :tries => 5,
           :error => proc { |got, try, total| print "#{got}? Try again (#{try}/#{total}) " },
           :out   => proc { |msg| print msg + '>> ' }