Method: Clashinator::Base#initialize
- Defined in:
- lib/clashinator/base.rb
#initialize(attrs) ⇒ Base
Returns a new instance of Base.
20 21 22 23 24 25 26 27 28 |
# File 'lib/clashinator/base.rb', line 20 def initialize(attrs) attrs.each do |name, val| lower_camel_cased = to_underscore(name) (class << self; self; end).send(:attr_reader, lower_camel_cased.to_sym) val = verify_hash_that_are_objects(lower_camel_cased.to_sym, val) val = verify_array_of_classes(lower_camel_cased.to_sym, val) instance_variable_set "@#{lower_camel_cased}", val end end |