Method: MakeStruct::CustomStruct#initialize
- Defined in:
- lib/thaip/make_struct.rb
#initialize(**argkw) ⇒ CustomStruct
Returns a new instance of CustomStruct.
3 4 5 6 7 8 9 10 |
# File 'lib/thaip/make_struct.rb', line 3 def initialize(**argkw) unknown_keys = argkw.keys - __acceptable_keys raise "Unknown ctor keys: #{unknown_keys}" unless unknown_keys.empty? __acceptable_keys.each do |key| instance_variable_set("@#{key}", argkw.fetch(key, __default_value(key))) end end |