Module: SEPA::Converter
- Included in:
- Account, CreditorAddress, DebtorAddress, Transaction
- Defined in:
- lib/sepa_king/converter.rb
Defined Under Namespace
Modules: InstanceMethods
Instance Method Summary collapse
Instance Method Details
#convert(*attributes, options) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/sepa_king/converter.rb', line 4 def convert(*attributes, ) include InstanceMethods method_name = "convert_#{[:to]}" raise ArgumentError.new("Converter '#{[:to]}' does not exist!") unless InstanceMethods.method_defined?(method_name) attributes.each do |attribute| define_method "#{attribute}=" do |value| instance_variable_set("@#{attribute}", send(method_name, value)) end end end |