Class: ChartCandy::Helpers::ChartCandyTagHelper
- Inherits:
-
Object
- Object
- ChartCandy::Helpers::ChartCandyTagHelper
show all
- Defined in:
- lib/chart-candy/helpers.rb
Instance Method Summary
collapse
Constructor Details
#initialize(rails_helpers, id, from, to, step) ⇒ ChartCandyTagHelper
Returns a new instance of ChartCandyTagHelper.
23
24
25
26
27
28
29
|
# File 'lib/chart-candy/helpers.rb', line 23
def initialize(rails_helpers, id, from, to, step)
@rails_helpers = rails_helpers
@id = id
@from = from
@to = to
@step = step || 'month'
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
159
160
161
162
163
164
165
|
# File 'lib/chart-candy/helpers.rb', line 159
def method_missing(*args, &block)
if [:candy, :content_tag, :form_tag, :link_to, :options_for_select, :select_tag].include?(args.first)
return @rails_helpers.send(*args, &block)
else
raise NoMethodError.new("undefined local variable or method '#{args.first}' for #{self.class}")
end
end
|
Instance Method Details
#counter(options = {}) ⇒ Object
31
32
33
34
35
|
# File 'lib/chart-candy/helpers.rb', line 31
def counter(options={})
options.reverse_merge! update_every: 1.minute, tools: nil
chart 'counter', options
end
|
#donut(options = {}) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/chart-candy/helpers.rb', line 50
def donut(options={})
options.reverse_merge! tools: {}
options[:tools].reverse_merge! export_xls: true, step: false, template: true
chart 'donut', options
end
|
37
38
39
40
41
|
# File 'lib/chart-candy/helpers.rb', line 37
def excel_chart_button(options={})
build_url 'line', options if not @url
tool_export_xls options[:label]
end
|
#line(options = {}) ⇒ Object
43
44
45
46
47
48
|
# File 'lib/chart-candy/helpers.rb', line 43
def line(options={})
options.reverse_merge! tools: {}
options[:tools].reverse_merge! export_xls: true, step: true, template: true
chart 'line', options
end
|