Class: Peanuts::Converter::Convert_decimal
- Inherits:
-
Convert_string
- Object
- 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
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() 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 |