Class: MapLayers::JsGenerator
- Inherits:
-
Object
- Object
- MapLayers::JsGenerator
- Defined in:
- lib/map_layers/js_wrapper.rb
Overview
:nodoc:
Instance Method Summary collapse
- #<<(javascript) ⇒ Object
- #assign(variable, value) ⇒ Object
-
#initialize ⇒ JsGenerator
constructor
A new instance of JsGenerator.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ JsGenerator
Returns a new instance of JsGenerator.
167 168 169 |
# File 'lib/map_layers/js_wrapper.rb', line 167 def initialize() @lines = '' end |
Instance Method Details
#<<(javascript) ⇒ Object
170 171 172 |
# File 'lib/map_layers/js_wrapper.rb', line 170 def <<(javascript) @lines << (javascript.is_a?(JsWrapper) ? javascript.to_javascript : javascript) << ";\n" end |
#assign(variable, value) ⇒ Object
173 174 175 |
# File 'lib/map_layers/js_wrapper.rb', line 173 def assign(variable, value) @lines << "#{variable} = #{JsWrapper::javascriptify_variable(value)};\n" end |
#to_s ⇒ Object
176 177 178 |
# File 'lib/map_layers/js_wrapper.rb', line 176 def to_s @lines end |