Class: ParamsReady::Value::BooleanCoder
- Inherits:
-
Coder
- Object
- AbstractCoder
- Coder
- ParamsReady::Value::BooleanCoder
- Defined in:
- lib/params_ready/value/coder.rb
Direct Known Subclasses
Class Method Summary collapse
Methods inherited from Coder
Methods included from Coercion
Methods inherited from AbstractCoder
Methods included from Extensions::ClassReaderWriter
Class Method Details
.coerce(input, _) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/params_ready/value/coder.rb', line 129 def self.coerce(input, _) return nil if input.nil? || input == '' return input if input.is_a?(TrueClass) || input.is_a?(FalseClass) str = input.to_s case str when 'true', 'TRUE', 't', 'T', '1' true when 'false', 'FALSE', 'f', 'F', '0' false else raise end end |
.format(value, format) ⇒ Object
143 144 145 |
# File 'lib/params_ready/value/coder.rb', line 143 def self.format(value, format) value.to_s end |