Class: IceCube::YamlParser
- Inherits:
-
HashParser
- Object
- HashParser
- IceCube::YamlParser
- Defined in:
- lib/ice_cube/parsers/yaml_parser.rb
Constant Summary collapse
- SERIALIZED_START =
/start_(?:time|date): .+(?<tz>(?:-|\+)\d{2}:\d{2})$/
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(yaml) ⇒ YamlParser
constructor
A new instance of YamlParser.
Methods inherited from HashParser
Constructor Details
#initialize(yaml) ⇒ YamlParser
Returns a new instance of YamlParser.
10 11 12 13 14 15 16 |
# File 'lib/ice_cube/parsers/yaml_parser.rb', line 10 def initialize(yaml) @hash = YAML::load(yaml) yaml.match SERIALIZED_START do |match| start_time = hash[:start_time] || hash[:start_date] TimeUtil.restore_deserialized_offset start_time, match[:tz] end end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
8 9 10 |
# File 'lib/ice_cube/parsers/yaml_parser.rb', line 8 def hash @hash end |