Method: Symgate::Type#initialize
- Defined in:
- lib/symgate/type.rb
#initialize(opts = {}) ⇒ Type
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/symgate/type.rb', line 7 def initialize(opts = {}) attrs = attributes self.class.class_eval { attr_accessor(*attrs) } opts.each do |key, _value| unless attributes.include? key raise Symgate::Error, "Unknown option #{key} for #{self.class.name}" end end attributes.each do |attribute| instance_variable_set "@#{attribute}", opts[attribute] end end |