Module: GoogleCharts::Helpers::ActionView

Defined in:
lib/google_charts/helpers/action_view.rb

Class Method Summary collapse

Class Method Details

.define_helper(name, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/google_charts/helpers/action_view.rb', line 5

def self.define_helper( name, options = {} )
  helper_name = [options[:prefix], name, options[:suffix]||'chart'].compact.join( '_' )

  module_eval "    def \#{helper_name}( *options )\n      chart = GoogleCharts::Charts::\#{name.to_s.capitalize}.new( self, *options )\n      yield chart if block_given?\n\n      concat chart.to_html\n    end\n  DEF\nend\n"