Class: Peanuts::Converter::Convert_decimal
- Inherits:
-
Convert_string
- Object
- Peanuts::Converter
- Convert_string
- Peanuts::Converter::Convert_decimal
- 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
- #from_xml(string) ⇒ Object
-
#initialize(options) ⇒ Convert_decimal
constructor
A new instance of Convert_decimal.
- #to_xml(int) ⇒ Object
Methods inherited from Peanuts::Converter
create, create!, lookup, lookup!
Constructor Details
#initialize(options) ⇒ Convert_decimal
Returns a new instance of Convert_decimal.
151 152 153 |
# File 'lib/peanuts/converters.rb', line 151 def initialize() super end |
Instance Method Details
#from_xml(string) ⇒ Object
159 160 161 |
# File 'lib/peanuts/converters.rb', line 159 def from_xml(string) (string = super(string)) && BigDecimal.new(string) end |
#to_xml(int) ⇒ Object
155 156 157 |
# File 'lib/peanuts/converters.rb', line 155 def to_xml(int) super(int && int.to_s('F')) end |