class GitGraph::GitHub::GraphableObject
Attributes
changed[RW]
chart_string[R]
chart_type[RW]
data[RW]
options[RW]
title[RW]
Public Class Methods
new(data, chart_type = nil, options = {}, title)
click to toggle source
data should be a graphable data object
# 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
Public Instance Methods
chart_type=(chart_type)
click to toggle source
# File lib/gitGraph/github/graphable_object.rb, line 18 def chart_type=(chart_type) @chart_type = chart_type @changed = true end
chart_type_to_string()
click to toggle source
# 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
data=(data)
click to toggle source
# File lib/gitGraph/github/graphable_object.rb, line 23 def data=(data) @data = check_data_param(data) @changed = true end
options=(options)
click to toggle source
# File lib/gitGraph/github/graphable_object.rb, line 28 def options=(options) @options = options @changed = true end
stringify()
click to toggle source
# File lib/gitGraph/github/graphable_object.rb, line 48 def stringify @chart_string = @data.stringify(@chart_type, @options) end
Private Instance Methods
check_data_param(data)
click to toggle source
# File lib/gitGraph/github/graphable_object.rb, line 53 def check_data_param(data) type = GitGraph::GitHub::GraphableData if !data.nil? && data.class != type raise ArgumentError, "The passed in data should be an object of type: #{type}." end data end