Class: Time

Inherits:
Object show all
Defined in:
lib/opium/extensions/time.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_parse(object) ⇒ Object



15
16
17
# File 'lib/opium/extensions/time.rb', line 15

def to_parse(object)
  object.to_time.to_parse if object
end

.to_ruby(object) ⇒ Object



10
11
12
13
# File 'lib/opium/extensions/time.rb', line 10

def to_ruby(object)
  object = object.utc if object.respond_to? :utc
  object.to_time if object
end

Instance Method Details

#to_parseObject



2
3
4
5
6
7
# File 'lib/opium/extensions/time.rb', line 2

def to_parse
  {
    '__type' => 'Date',
    'iso' => self.iso8601
  }
end