Module: AfterShip::Attributes

Included in:
Checkpoint, Courier, Tracking
Defined in:
lib/after_ship/core/attributes.rb

Overview

Extracted attributes loading.

Instance Method Summary collapse

Instance Method Details

#load_attributes(data) ⇒ Object

Loop through the data hash and for each key call a setter with the value.

Parameters:

  • data (Hash)


7
8
9
10
11
12
# File 'lib/after_ship/core/attributes.rb', line 7

def load_attributes(data)
  data.each do |attribute, value|
    setter = "#{attribute}="
    send(setter, value) if respond_to?(setter)
  end
end