Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/mapping/core_classes_mapping.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_from_xml(xml, options = {:mapping=>:_default}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/xml/mapping/core_classes_mapping.rb', line 17

def self.load_from_xml(xml, options={:mapping=>:_default})
  begin
    Integer(xml.text)
  rescue ArgumentError
    Float(xml.text)
  end
end

Instance Method Details

#fill_into_xml(xml, options = {:mapping=>:_default}) ⇒ Object



25
26
27
# File 'lib/xml/mapping/core_classes_mapping.rb', line 25

def fill_into_xml(xml, options={:mapping=>:_default})
  xml.text = self.to_s
end

#textObject



29
30
31
# File 'lib/xml/mapping/core_classes_mapping.rb', line 29

def text
  self.to_s
end