Class: Melitta::Coercers::Boolean
- Inherits:
-
Struct
- Object
- Struct
- Melitta::Coercers::Boolean
- Defined in:
- lib/melitta/coercers.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
Instance Method Summary collapse
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input
58 59 60 |
# File 'lib/melitta/coercers.rb', line 58 def input @input end |
Instance Method Details
#output ⇒ Object
64 65 66 |
# File 'lib/melitta/coercers.rb', line 64 def output (input =~ (/(true|1)$/i)) === 0 end |
#valid? ⇒ Boolean
60 61 62 |
# File 'lib/melitta/coercers.rb', line 60 def valid? input.blank? || input =~ (/\A(true|1|false|0)\z/i) end |