Module: MarkMapper::Extensions::Boolean

Defined in:
lib/mark_mapper/extensions/boolean.rb

Constant Summary collapse

Mapping =
{
  true    => true,
  'true'  => true,
  'TRUE'  => true,
  'True'  => true,
  't'     => true,
  'T'     => true,
  '1'     => true,
  1       => true,
  1.0     => true,
  false   => false,
  'false' => false,
  'FALSE' => false,
  'False' => false,
  'f'     => false,
  'F'     => false,
  '0'     => false,
  0       => false,
  0.0     => false,
  nil     => nil
}

Instance Method Summary collapse

Instance Method Details

#from_marklogic(value) ⇒ Object


31
32
33
34
# File 'lib/mark_mapper/extensions/boolean.rb', line 31

def from_marklogic(value)
  return nil if value == nil
  !!value
end

#to_marklogic(value) ⇒ Object


27
28
29
# File 'lib/mark_mapper/extensions/boolean.rb', line 27

def to_marklogic(value)
  Mapping[value]
end

#xs_typeObject


36
37
38
# File 'lib/mark_mapper/extensions/boolean.rb', line 36

def xs_type
  "boolean"
end