Module: Stitcher::Accessor
Instance Method Summary
collapse
Methods included from Register
define_call_method, register, #stitcher_register
Instance Method Details
#stitcher_accessor(**opt) ⇒ Object
17
18
19
20
|
# File 'lib/stitcher/accessor.rb', line 17
def stitcher_accessor **opt
attr_reader *opt.keys
Accessor.instance_method(:stitcher_writer).bind(self).(opt)
end
|
#stitcher_writer(**opt) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/stitcher/accessor.rb', line 9
def stitcher_writer **opt
opt.each { |name, type|
Register.register(self, "#{name}=", [type], (DefineMethod.as_instance_executable do |var|
instance_variable_set "@#{name}", var
end))
}
end
|