Class: GithubChart::Chart
- Inherits:
-
Object
- Object
- GithubChart::Chart
- Defined in:
- lib/githubchart.rb,
lib/githubchart/svg.rb
Overview
Convert stats into SVG
Instance Attribute Summary collapse
-
#colors ⇒ Object
Returns the value of attribute colors.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Chart
constructor
Create a new chart object Passes the username through to GithubStats Uses colors rather than default, if provided.
- #render(type) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Chart
Create a new chart object Passes the username through to GithubStats Uses colors rather than default, if provided
59 60 61 62 63 64 |
# File 'lib/githubchart.rb', line 59 def initialize(params = {}) params = { user: params } unless params.is_a? Hash @stats = load_stats(params[:data], params[:user]) @colors = params[:colors] || :default @colors = COLOR_SCHEMES[@colors] unless @colors.is_a? Array end |
Instance Attribute Details
#colors ⇒ Object
Returns the value of attribute colors.
52 53 54 |
# File 'lib/githubchart.rb', line 52 def colors @colors end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
51 52 53 |
# File 'lib/githubchart.rb', line 51 def stats @stats end |
Instance Method Details
#render(type) ⇒ Object
66 67 68 69 |
# File 'lib/githubchart.rb', line 66 def render(type) raise(NameError, "Format #{type} is unsupported.") unless GithubChart.supports? type send("render_#{type}".to_sym) end |