Module: Micro::Struct::Factory::CreateStruct::InstanceScope
- Defined in:
- lib/micro/struct/factory/create_struct.rb
Class Method Summary collapse
Class Method Details
.def_to_ary(struct) ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/micro/struct/factory/create_struct.rb', line 86 def self.def_to_ary(struct) struct.class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def to_ary to_a end RUBY end |
.def_to_hash(struct) ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/micro/struct/factory/create_struct.rb', line 94 def self.def_to_hash(struct) struct.class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def to_hash to_h end RUBY end |
.def_with(struct) ⇒ Object
102 103 104 105 106 107 108 |
# File 'lib/micro/struct/factory/create_struct.rb', line 102 def self.def_with(struct) struct.class_eval(<<-RUBY, __FILE__, __LINE__ + 1) def with(**members) self.class.new(**to_h.merge(members)) end RUBY end |