Module: RocketGate::Hashable
- Included in:
- CreditCard, Customer, Transaction
- Defined in:
- lib/rocketgate/hashable.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
32 33 34 |
# File 'lib/rocketgate/hashable.rb', line 32 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#to_hash ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rocketgate/hashable.rb', line 36 def to_hash hash = Hash.new.tap do |hsh| self.class.mappings.each do |display_name, obj| hsh[display_name] = attribute_or_proc_value(obj) end end self.class.mergables.each do |obj| hash.merge!(attribute_or_proc_value(obj)) end if self.class.mergables.any? hash end |