module Nyaplot::Jsonizable

The module to be included by internal classes

Public Class Methods

included(cls) click to toggle source
# File lib/nyaplot/base.rb, line 8
def self.included(cls)
  cls.extend ClassMethod
end

Public Instance Methods

before_to_json() click to toggle source
# File lib/nyaplot/base.rb, line 12
def before_to_json
end
get_property(symbol) click to toggle source

Prepared to expressly get property

# File lib/nyaplot/base.rb, line 31
def get_property(symbol)
  self.send(symbol)
end
init_properties() click to toggle source

This method should be excuted when initializing class includes Jsonizable

# File lib/nyaplot/base.rb, line 16
def init_properties
  @properties = {}
end
set_property(symbol, val) click to toggle source

Prepared to expressly set property

# File lib/nyaplot/base.rb, line 26
def set_property(symbol, val)
  self.send(symbol, val)
end
to_json(*args) click to toggle source
# File lib/nyaplot/base.rb, line 20
def to_json(*args)
  before_to_json
  @properties.to_json
end