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.
9 10 11 12 13 14 15 |
# File 'lib/ice_cube/parsers/yaml_parser.rb', line 9 def initialize(yaml) @hash = YAML.safe_load(yaml, permitted_classes: [Date, Symbol, Time], aliases: true) 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.
7 8 9 |
# File 'lib/ice_cube/parsers/yaml_parser.rb', line 7 def hash @hash end |