Module: Bluepay::Parameters::ClassMethods
- Defined in:
- lib/bluepay/parameters.rb
Instance Method Summary collapse
- #convert(*args) ⇒ Object
- #convert!(param, value) ⇒ Object
- #converter(param) ⇒ Object
- #converters ⇒ Object
Instance Method Details
#convert(*args) ⇒ Object
20 21 22 23 |
# File 'lib/bluepay/parameters.rb', line 20 def convert(*args) converter = args.pop args.each {|arg| self.converters[arg] = converter } end |
#convert!(param, value) ⇒ Object
35 36 37 38 39 |
# File 'lib/bluepay/parameters.rb', line 35 def convert!(param, value) converter = converter(param) converter ||= DEFAULT_CONVERTER converter.call(value) end |
#converter(param) ⇒ Object
29 30 31 32 33 |
# File 'lib/bluepay/parameters.rb', line 29 def converter(param) converter = self.converters[param] converter ||= self.superclass.converter(param) rescue nil converter end |
#converters ⇒ Object
25 26 27 |
# File 'lib/bluepay/parameters.rb', line 25 def converters @_converters ||= Hash.new end |