Module: Exlibris::Primo::WriteAttributes

Overview

Write passed in arguments to instance attributes

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object


8
9
10
11
12
13
# File 'lib/exlibris/primo/write_attributes.rb', line 8

def initialize *args
  # Just call super w/o any args for now.  Eventually, we'll want to check the arity and adjust.
  # self.class.superclass.instance_method(:initialize).arity.eql? self.class.instance_method(:initialize).arity
  super()
  write_attributes args.last unless args.last.nil?
end

#write_attributes(attributes) ⇒ Object


15
16
17
18
19
# File 'lib/exlibris/primo/write_attributes.rb', line 15

def write_attributes attributes
  attributes.each do |attribute, value|
    write_attribute attribute, value
  end
end