Module: Frusdl::Wrap::ClassMethods
- Defined in:
- lib/frusdl/wrap.rb
Instance Method Summary collapse
- #make_struct_reader(name, sname = nil) ⇒ Object
- #make_struct_writer(name, sname = nil) ⇒ Object
- #struct_accessor(name, sname = nil) ⇒ Object
- #struct_reader(name, sname = nil) ⇒ Object
Instance Method Details
#make_struct_reader(name, sname = nil) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/frusdl/wrap.rb', line 4 def make_struct_reader(name, sname = nil) method_name = name.to_sym struct_name = sname ? sname.to_sym : method_name define_method(method_name) do return @struct[struct_name] end end |
#make_struct_writer(name, sname = nil) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/frusdl/wrap.rb', line 12 def make_struct_writer(name, sname = nil) method_name = "#{name}=".to_sym struct_name = sname ? sname.to_sym : name.to_sym define_method(method_name) do | value | return @struct[struct_name] = value end end |
#struct_accessor(name, sname = nil) ⇒ Object
20 21 22 23 |
# File 'lib/frusdl/wrap.rb', line 20 def struct_accessor(name, sname = nil) make_struct_reader name, sname make_struct_writer name, sname end |
#struct_reader(name, sname = nil) ⇒ Object
25 26 27 |
# File 'lib/frusdl/wrap.rb', line 25 def struct_reader(name, sname = nil) make_struct_reader name, sname end |