Class: Peanuts::Converter::Convert_integer

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

Overview

An integer.

Specifier

:integer

Options

Accepts all options of Convert_string.

Instance Method Summary collapse

Methods inherited from Peanuts::Converter

create, create!, lookup, lookup!

Constructor Details

#initialize(options) ⇒ Convert_integer

Returns a new instance of Convert_integer.



130
131
132
# File 'lib/peanuts/converters.rb', line 130

def initialize(options)
  super
end

Instance Method Details

#from_xml(string) ⇒ Object



138
139
140
# File 'lib/peanuts/converters.rb', line 138

def from_xml(string)
  (string = super(string)) && Integer(string)
end

#to_xml(int) ⇒ Object



134
135
136
# File 'lib/peanuts/converters.rb', line 134

def to_xml(int)
  super(int.to_s)
end