Module: MarkMapper::Extensions::Integer

Included in:
Integer
Defined in:
lib/mark_mapper/extensions/integer.rb

Instance Method Summary collapse

Instance Method Details

#from_marklogic(value) ⇒ Object


14
15
16
# File 'lib/mark_mapper/extensions/integer.rb', line 14

def from_marklogic(value)
  value && value.to_i
end

#to_marklogic(value) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/mark_mapper/extensions/integer.rb', line 5

def to_marklogic(value)
  value_to_i = value.to_i
  if value_to_i == 0 && value != value_to_i
    value.to_s =~ /^(0x|0b)?0+/ ? 0 : nil
  else
    value_to_i
  end
end

#xs_typeObject


18
19
20
# File 'lib/mark_mapper/extensions/integer.rb', line 18

def xs_type
  "int"
end