Module: Nyaplot::Jsonizable::ClassMethod
- Defined in:
- lib/nyaplot/base.rb
Instance Method Summary collapse
-
#define_group_properties(name, symbols) ⇒ Object
Define getter/setter for each property and group.
-
#define_properties(*symbols) ⇒ Object
Define getter/setter for each property.
Instance Method Details
#define_group_properties(name, symbols) ⇒ Object
Define getter/setter for each property and group. Grouped properties will be merged into one parameter when running to_json.
58 59 60 61 62 63 64 65 66 |
# File 'lib/nyaplot/base.rb', line 58 def define_group_properties(name, symbols) define_properties(name) symbols.each do |symbol| define_method(symbol) {|val=nil| return @properties[name][symbol] if val.nil? @properties[name][symbol] = val } end end |
#define_properties(*symbols) ⇒ Object
Define getter/setter for each property
39 40 41 42 43 44 45 46 |
# File 'lib/nyaplot/base.rb', line 39 def define_properties(*symbols) symbols.each do |symbol| define_method(symbol) {|val=nil| return @properties[symbol] if val.nil? @properties[symbol] = val } end end |