Module: Mondido::BaseBehaviour
- Included in:
- CreditCard::Transaction
- Defined in:
- lib/mondido/base_behaviour.rb
Instance Method Summary collapse
Instance Method Details
#initialize(attributes = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/mondido/base_behaviour.rb', line 3 def initialize(attributes={}) setters = self.methods .select{ |method| !method.to_s.match(/=\z/).nil? && method.match(/\A(!|=|_)/).nil? } .map{ |method| method.to_s[0, method.length-1].to_sym } attributes.select!{ |k,v| setters.include?(k) } super(attributes) end |