Class: GitGraph::GitHub::GraphableObject

Inherits:
Object
  • Object
show all
Defined in:
lib/gitGraph/github/graphable_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {}, title)
  @data = check_data_param(data)
  @options = options
  @changed = true
  @chart_type = chart_type || :line
  @title = title
end

Instance Attribute Details

#changedObject

Returns the value of attribute changed.



6
7
8
# File 'lib/gitGraph/github/graphable_object.rb', line 6

def changed
  @changed
end

#chart_stringObject (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_typeObject

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

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/gitGraph/github/graphable_object.rb', line 6

def data
  @data
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/gitGraph/github/graphable_object.rb', line 6

def options
  @options
end

#titleObject

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_stringObject



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

#stringifyObject



48
49
50
# File 'lib/gitGraph/github/graphable_object.rb', line 48

def stringify
  @chart_string = @data.stringify(@chart_type, @options)
end