Class: GitGraph::GitHub::GraphableObject
- Inherits:
-
Object
- Object
- GitGraph::GitHub::GraphableObject
- Defined in:
- lib/gitGraph/github/graphable_object.rb
Instance Attribute Summary collapse
-
#changed ⇒ Object
Returns the value of attribute changed.
-
#chart_string ⇒ Object
readonly
Returns the value of attribute chart_string.
-
#chart_type ⇒ Object
Returns the value of attribute chart_type.
-
#data ⇒ Object
Returns the value of attribute data.
-
#options ⇒ Object
Returns the value of attribute options.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #chart_type_to_string ⇒ Object
-
#initialize(data, chart_type = nil, options = {}, title) ⇒ GraphableObject
constructor
data should be a graphable data object.
- #stringify ⇒ Object
Constructor Details
#initialize(data, chart_type = nil, options = {}, title) ⇒ GraphableObject
data should be a graphable data object
10 11 12 13 14 15 16 |
# File 'lib/gitGraph/github/graphable_object.rb', line 10 def initialize(data, chart_type = nil, = {}, title) @data = check_data_param(data) @options = @changed = true @chart_type = chart_type || :line @title = title end |
Instance Attribute Details
#changed ⇒ Object
Returns the value of attribute changed.
6 7 8 |
# File 'lib/gitGraph/github/graphable_object.rb', line 6 def changed @changed end |
#chart_string ⇒ Object (readonly)
Returns the value of attribute chart_string.
7 8 9 |
# File 'lib/gitGraph/github/graphable_object.rb', line 7 def chart_string @chart_string end |
#chart_type ⇒ Object
Returns the value of attribute chart_type.
6 7 8 |
# File 'lib/gitGraph/github/graphable_object.rb', line 6 def chart_type @chart_type end |
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/gitGraph/github/graphable_object.rb', line 6 def data @data end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/gitGraph/github/graphable_object.rb', line 6 def @options end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/gitGraph/github/graphable_object.rb', line 6 def title @title end |
Instance Method Details
#chart_type_to_string ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gitGraph/github/graphable_object.rb', line 33 def chart_type_to_string case @chart_type when :line "Line" when :radar "Radar" when (:donut) || (:doughnut) "Doughnut" when :polar_area "PolarArea" when :bar "Bar" end end |
#stringify ⇒ Object
48 49 50 |
# File 'lib/gitGraph/github/graphable_object.rb', line 48 def stringify @chart_string = @data.stringify(@chart_type, @options) end |