Module: Trybool
- Defined in:
- lib/trybool.rb,
lib/trybool/version.rb
Constant Summary collapse
- TRUTHY_VALUES =
[ true, 1, "1", "t", "T", "true", "TRUE", "on", "ON", ]
- VERSION =
"0.1.0"
Class Method Summary collapse
- .<<(value) ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .parse(value) ⇒ Object
- .truthy_values ⇒ Object
Class Method Details
.<<(value) ⇒ Object
20 21 22 |
# File 'lib/trybool.rb', line 20 def self.<<(value) Array(value).each { |v| truthy_values << v } end |
.configure {|_self| ... } ⇒ Object
16 17 18 |
# File 'lib/trybool.rb', line 16 def self.configure yield(self) end |
.parse(value) ⇒ Object
24 25 26 |
# File 'lib/trybool.rb', line 24 def self.parse(value) truthy_values.include?(value) end |
.truthy_values ⇒ Object
28 29 30 |
# File 'lib/trybool.rb', line 28 def self.truthy_values @truthy_values ||= Set[*TRUTHY_VALUES] end |