Module: Nyaplot::Jsonizable

Overview

The module to be included by internal classes

Defined Under Namespace

Modules: ClassMethod

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(cls) ⇒ Object



8
9
10
# File 'lib/nyaplot/base.rb', line 8

def self.included(cls)
  cls.extend ClassMethod
end

Instance Method Details

#before_to_jsonObject



12
13
# File 'lib/nyaplot/base.rb', line 12

def before_to_json
end

#get_property(symbol) ⇒ Object

Prepared to expressly get property



31
32
33
# File 'lib/nyaplot/base.rb', line 31

def get_property(symbol)
  self.send(symbol)
end

#init_propertiesObject

This method should be excuted when initializing class includes Jsonizable



16
17
18
# File 'lib/nyaplot/base.rb', line 16

def init_properties
  @properties = {}
end

#set_property(symbol, val) ⇒ Object

Prepared to expressly set property



26
27
28
# File 'lib/nyaplot/base.rb', line 26

def set_property(symbol, val)
  self.send(symbol, val)
end

#to_json(*args) ⇒ Object



20
21
22
23
# File 'lib/nyaplot/base.rb', line 20

def to_json(*args)
  before_to_json
  @properties.to_json
end