Class: GoogleVisualr::PatternFormat
- Inherits:
-
Formatter
- Object
- Formatter
- GoogleVisualr::PatternFormat
- Defined in:
- lib/daru/view/adapters/googlecharts/formatters.rb
Instance Attribute Summary collapse
-
#des_col ⇒ Object
Returns the value of attribute des_col.
Instance Method Summary collapse
-
#initialize(format_string = '') ⇒ PatternFormat
constructor
A new instance of PatternFormat.
- #src_cols=(*columns) ⇒ Object
- #to_js ⇒ Object
Constructor Details
#initialize(format_string = '') ⇒ PatternFormat
Returns a new instance of PatternFormat.
4 5 6 |
# File 'lib/daru/view/adapters/googlecharts/formatters.rb', line 4 def initialize(format_string='') @format_string = format_string end |
Instance Attribute Details
#des_col ⇒ Object
Returns the value of attribute des_col.
3 4 5 |
# File 'lib/daru/view/adapters/googlecharts/formatters.rb', line 3 def des_col @des_col end |
Instance Method Details
#src_cols=(*columns) ⇒ Object
8 9 10 |
# File 'lib/daru/view/adapters/googlecharts/formatters.rb', line 8 def src_cols=(*columns) @src_cols = columns.flatten end |
#to_js ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/daru/view/adapters/googlecharts/formatters.rb', line 12 def to_js js = "\nvar formatter = "\ "new google.visualization.#{self.class.to_s.split('::').last}(" js << "'#{@format_string}'" js << ');' js << "\nformatter.format(data_table, #{@src_cols}, #{@des_col});" end |