Class: FrOData::Properties::Time
- Inherits:
-
FrOData::Property
- Object
- FrOData::Property
- FrOData::Properties::Time
- Defined in:
- lib/frodata/properties/time.rb
Overview
Defines the Time FrOData type.
Instance Attribute Summary
Attributes inherited from FrOData::Property
Instance Method Summary collapse
-
#type ⇒ Object
The FrOData type name.
-
#value ⇒ Time?
Returns the property value, properly typecast.
-
#value=(new_value) ⇒ Object
Sets the property value.
Methods inherited from FrOData::Property
#==, #allows_nil?, #concurrency_mode, from_xml, #initialize, #json_value, #strict?, #to_xml, #url_value, #xml_value
Constructor Details
This class inherits a constructor from FrOData::Property
Instance Method Details
#type ⇒ Object
The FrOData type name
23 24 25 |
# File 'lib/frodata/properties/time.rb', line 23 def type 'Edm.Time' end |
#value ⇒ Time?
Returns the property value, properly typecast
7 8 9 10 11 12 13 |
# File 'lib/frodata/properties/time.rb', line 7 def value if (@value.nil? || @value.empty?) && allows_nil? nil else ::Time.strptime(@value, '%H:%M:%S%:z') end end |
#value=(new_value) ⇒ Object
Sets the property value
17 18 19 20 |
# File 'lib/frodata/properties/time.rb', line 17 def value=(new_value) validate(new_value) @value = parse_value(new_value) end |