Class: SDL::Types::SDLMoney

Inherits:
SDLSimpleType show all
Includes:
SDLType
Defined in:
lib/sdl/types/sdl_money.rb,
lib/sdl/exporters/xml_mapping.rb

Instance Attribute Summary

Attributes inherited from SDLSimpleType

#parent, #parent_index, #raw_value, #value

Instance Method Summary collapse

Methods included from SDLType

codes, included, #xml_attributes

Methods inherited from SDLSimpleType

#==, #annotated?, #annotations, #initialize, #initialize_value, #to_s

Constructor Details

This class inherits a constructor from SDL::Types::SDLSimpleType

Instance Method Details

#from_string(string_value) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/sdl/types/sdl_money.rb', line 10

def from_string(string_value)
  begin
    @value = Monetize.parse(string_value)
  rescue ArgumentError
    throw "Invalid Money value: #{string_value}"
  end
end

#xml_valueObject



80
81
82
# File 'lib/sdl/exporters/xml_mapping.rb', line 80

def xml_value
  raw_value
end