Class: MakeStruct::CustomStruct
- Inherits:
-
Object
- Object
- MakeStruct::CustomStruct
- Defined in:
- lib/thaip/make_struct.rb
Instance Method Summary collapse
-
#initialize(**argkw) ⇒ CustomStruct
constructor
A new instance of CustomStruct.
Constructor Details
#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 |