Class: RailsCharts::Javascript

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_charts/javascript.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Javascript

Returns a new instance of Javascript.



5
6
7
# File 'lib/rails_charts/javascript.rb', line 5

def initialize(code)
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/rails_charts/javascript.rb', line 3

def code
  @code
end

Instance Method Details

#as_json(options = nil) ⇒ Object



9
10
11
# File 'lib/rails_charts/javascript.rb', line 9

def as_json(options = nil)
  "RAILS_CHART_JS:#{Base64.strict_encode64(code)}:RAILS_CHART_JS_END"
end