Class: Peanuts::Converter::Convert_decimal

Inherits:
Convert_string show all
Defined in:
lib/peanuts/converters.rb

Overview

A decimal.

Specifier

:decimal

Ruby type

BigDecimal

Options

Accepts all options of Convert_string.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Convert_decimal

Returns a new instance of Convert_decimal.



142
143
144
# File 'lib/peanuts/converters.rb', line 142

def initialize(options)
  super
end

Instance Method Details

#from_xml(string) ⇒ Object



150
151
152
# File 'lib/peanuts/converters.rb', line 150

def from_xml(string)
  (string = super(string)) && BigDecimal.new(string)
end

#to_xml(int) ⇒ Object



146
147
148
# File 'lib/peanuts/converters.rb', line 146

def to_xml(int)
  super(int && int.to_s('F'))
end