class Ari::Model

Public Class Methods

new(attributes) click to toggle source
# File lib/ari/model.rb, line 6
def initialize(attributes)
  if attributes
    @client = attributes.delete(:client)
    self.attributes = attributes
  end
end

Public Instance Methods

attributes=(attributes) click to toggle source
# File lib/ari/model.rb, line 13
def attributes=(attributes)
  attributes.each do |name, value|
    setter = "#{name}="
    if respond_to? setter
      value.merge!(client: @client) if @client && value.is_a?(Hash)
      __send__ setter, value
    else
      instance_variable_set "@#{name}", value
    end
  end
end