Class: MapLayers::JsGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/map_layers/js_wrapper.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeJsGenerator

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_sObject


176
177
178
# File 'lib/map_layers/js_wrapper.rb', line 176

def to_s
  @lines
end