Sha256: 3ce3eadd835a41448048e3d175506436bcb5867e15efdb0a4116670a953d6eef
Contents?: true
Size: 823 Bytes
Versions: 1
Compression:
Stored size: 823 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 ``` ## Install ```ruby $ gem install yano ``` ## 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.0 | README.md |