Class: DateTime
- Inherits:
-
Object
- Object
- DateTime
- Defined in:
- lib/zenaton/refinements/date_time.rb
Overview
Reimplements ‘json/add/date_time`
Class Method Summary collapse
-
.from_zenaton(props) ⇒ Object
Parse from simple hash.
Class Method Details
.from_zenaton(props) ⇒ Object
Parse from simple hash
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/zenaton/refinements/date_time.rb', line 29 def self.from_zenaton(props) args = props.values_at('y', 'm', 'd', 'H', 'M', 'S') of_a, of_b = props['of'].split('/') # rubocop:disable Style/ConditionalAssignment if of_b && of_b != '0' args << Rational(of_a.to_i, of_b.to_i) else args << of_a end # rubocop:enable Style/ConditionalAssignment args << props['sg'] civil(*args) end |