Sha256: a9a8a12122c5ee2efdd29d05abba7f31b1c48f4f6885e7c3179b77d254d628ae

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

```
..............................................
..####...#####....####...##....##..##...####..
.##......##..##..##......##.....####...##..##.
..####...#####....####...##......##.......##..
.....##..##..##......##..##......##......##...
..####...##..##...####...######..##......##...
..............................................
```

```ruby
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 + '>> ' }
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
srsly-1.0.1 README.md
srsly-1.0.0 README.md