Class: Db2Query::Type::Boolean
- Defined in:
- lib/db2_query/type/boolean.rb
Constant Summary collapse
- TRUE_VALUES =
[ true, 1, "1", "t", "T", "true", "TRUE", "on", "ON", :"1", :t, :T, :true, :TRUE, :on, :ON ].freeze
- DEFAULT =
{ true: true, false: false }
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
- #deserialize(value) ⇒ Object
-
#initialize(options = DEFAULT) ⇒ Boolean
constructor
A new instance of Boolean.
- #name ⇒ Object
- #serialize(value) ⇒ Object
Methods inherited from Value
Constructor Details
Instance Method Details
#deserialize(value) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/db2_query/type/boolean.rb', line 31 def deserialize(value) case value when 1 [:true] else [:false] end end |
#name ⇒ Object
18 19 20 |
# File 'lib/db2_query/type/boolean.rb', line 18 def name :boolean end |
#serialize(value) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/db2_query/type/boolean.rb', line 22 def serialize(value) case value when *TRUE_VALUES 1 else 0 end end |