Class: AmCharts::ChartBuilder::Function
- Inherits:
-
Object
- Object
- AmCharts::ChartBuilder::Function
- Defined in:
- lib/amcharts/chart_builder/function.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, body = nil) ⇒ Function
constructor
A new instance of Function.
- #to_json ⇒ Object
Constructor Details
#initialize(name, body = nil) ⇒ Function
Returns a new instance of Function.
6 7 8 |
# File 'lib/amcharts/chart_builder/function.rb', line 6 def initialize(name, body = nil) @name, @body = name, body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/amcharts/chart_builder/function.rb', line 4 def body @body end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/amcharts/chart_builder/function.rb', line 4 def name @name end |
Instance Method Details
#to_json ⇒ Object
10 11 12 |
# File 'lib/amcharts/chart_builder/function.rb', line 10 def to_json body.nil? ? name.to_s : "function #{name}() { #{body} }" end |