Module: TomlRB::OffsetDateTimeParser

Defined in:
lib/toml-rb/datetime.rb

Instance Method Summary collapse

Instance Method Details

#valueObject



3
4
5
6
7
8
9
10
# File 'lib/toml-rb/datetime.rb', line 3

def value
  skeleton = captures[:datetime_skeleton].first
  year, mon, day, hour, min, sec, sec_frac = skeleton.value
  offset = captures[:date_offset].first || "+00:00"
  sec = "#{sec}.#{sec_frac}".to_f

  Time.new(year, mon, day, hour, min, sec, offset.to_s)
end