Module: MarkMapper::Extensions::Time

Included in:
Time
Defined in:
lib/mark_mapper/extensions/time.rb

Instance Method Summary collapse

Instance Method Details

#from_marklogic(value) ⇒ Object


16
17
18
# File 'lib/mark_mapper/extensions/time.rb', line 16

def from_marklogic(value)
  to_marklogic(value)
end

#to_marklogic(value) ⇒ Object


7
8
9
10
11
12
13
14
# File 'lib/mark_mapper/extensions/time.rb', line 7

def to_marklogic(value)
  if !value || '' == value
    nil
  else
    time_class = ::Time.zone || ::Time
    time = value.is_a?(::Time) ? value : time_class.parse(value.to_s, time_class.now)
  end
end

#xs_typeObject


20
21
22
# File 'lib/mark_mapper/extensions/time.rb', line 20

def xs_type
  "dateTime"
end