Module: Kuzira

Defined in:
lib/kuzira.rb,
lib/kuzira/errors.rb

Defined Under Namespace

Classes: UnknownAttributeError

Instance Method Summary collapse

Instance Method Details

#initialize(attributes = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/kuzira.rb', line 4

def initialize(attributes = {})
  if attributes
    attributes.each do |key, value|
      setter = :"#{key}="

      if respond_to?(setter)
        public_send(setter, value) if respond_to?(setter)
      else
        raise UnknownAttributeError.new(self, value)
      end
    end
  end
end