Class: ChartLine
- Inherits:
-
Object
- Object
- ChartLine
- Defined in:
- app/models/chart_line.rb
Overview
Class to handle line definition on a Chart
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#value_method ⇒ Object
readonly
Returns the value of attribute value_method.
Class Method Summary collapse
-
.value_methods(lines) ⇒ Object
class method given an array of lines returns an array of value_methods (not necessarily unique).
Instance Method Summary collapse
-
#as_hash ⇒ Object
returns the values that are to be passed to the client browser, as a hash.
-
#initialize(tag, color, value_method, options = {}) ⇒ ChartLine
constructor
constructor taking tag string, line colour and a getter method of Sample to get the value.
Constructor Details
#initialize(tag, color, value_method, options = {}) ⇒ ChartLine
constructor taking tag string, line colour and a getter method of Sample to get the value
6 7 8 9 10 11 |
# File 'app/models/chart_line.rb', line 6 def initialize( tag, color, value_method, ={} ) @tag = tag @color = color @value_method = value_method @options = end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
3 4 5 |
# File 'app/models/chart_line.rb', line 3 def color @color end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'app/models/chart_line.rb', line 3 def @options end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'app/models/chart_line.rb', line 3 def tag @tag end |
#value_method ⇒ Object (readonly)
Returns the value of attribute value_method.
3 4 5 |
# File 'app/models/chart_line.rb', line 3 def value_method @value_method end |
Class Method Details
.value_methods(lines) ⇒ Object
class method given an array of lines returns an array of value_methods (not necessarily unique)
19 20 21 |
# File 'app/models/chart_line.rb', line 19 def self.value_methods( lines ) lines.map { |l| l.value_method } end |
Instance Method Details
#as_hash ⇒ Object
returns the values that are to be passed to the client browser, as a hash
14 15 16 |
# File 'app/models/chart_line.rb', line 14 def as_hash {:tag => @tag, :color => @color, :value_method => @value_method, :options => @options} end |