Class: AWS::Record::Attributes::BooleanAttr
- Defined in:
- lib/aws/record/attributes.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseAttr
Class Method Summary collapse
Methods inherited from BaseAttr
#default_value, deserialize, #deserialize, #initialize, #persist_as, #serialize, #set?, #type_cast
Constructor Details
This class inherits a constructor from AWS::Record::Attributes::BaseAttr
Class Method Details
.serialize(boolean, options = {}) ⇒ Object
164 165 166 167 168 169 170 171 172 |
# File 'lib/aws/record/attributes.rb', line 164 def self.serialize boolean, = {} case boolean when false then 0 when true then 1 else msg = "expected a boolean value, got #{boolean.class}" raise ArgumentError, msg end end |
.type_cast(raw_value, options = {}) ⇒ Object
155 156 157 158 159 160 161 162 |
# File 'lib/aws/record/attributes.rb', line 155 def self.type_cast raw_value, = {} case raw_value when nil then nil when '' then nil when false, 'false', '0', 0 then false else true end end |