Class: Transit::Deliverable::DeliveryOptions

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/transit/deliverable.rb

Instance Method Summary collapse

Instance Method Details

#merge!(hash = {}) ⇒ Object



21
22
23
24
25
# File 'lib/transit/deliverable.rb', line 21

def merge!(hash = {})
  hash.each_pair do |key, value|
    self.send(:#{key.to_s}=", value)
  end
end

#reverse_merge!(hash = {}) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/transit/deliverable.rb', line 27

def reverse_merge!(hash = {})
  hash.each_pair do |key, value|
    next unless self.try(:#{key.to_s}")
    self.new_ostruct_member(:#{key.to_s}")
    self.send(:#{key.to_s}=", value)
  end
end