Sha256: f397a9f47f5573f5f4d928f6a91a5314f13c56ca20937025afa15179c2e80592
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
# Yano **This is a ruby port of [yn](https://github.com/sindresorhus/yn) by [sindresorhus](https://github.com/sindresorhus)** > Parse yes/no like values Useful for validating answers to a CLI prompt. - The following case-insensitive values are recognized: ```ruby 'y', 'yes', 'true', true, '1', 1, 'n', 'no', 'false', false, '0', 0 ``` ## Installation Add this line to your application's Gemfile: ```ruby gem 'yano' ``` And then execute: $ bundle Or install it yourself as: $ gem install memoist_redux ## Usage ```ruby Yano.parse('y'); #=> true Yano.parse('NO'); #=> false Yano.parse(true); #=> true Yano.parse('abomasum'); #=> nil # lenient mode will use a key distance-based score # to leniently accept typos of "yes" and "no" Yano.parse('mo', lenient: true); #=> false ``` Unrecognized values return `nil` ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yano-0.1.1 | README.md |