Class: MapLayers::JsExpr

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

Overview

A valid JavaScript expression that has a value.

Direct Known Subclasses

JsVar

Constant Summary collapse

UNDEFINED =
JsExpr.new("undefined")

Instance Attribute Summary

Attributes included from JsWrapper

#variable

Instance Method Summary collapse

Methods included from JsWrapper

#[], #assign_to, #declare, #declare_random, #declared?, escape_javascript, #get_property, javascriptify_method, #javascriptify_method_call, javascriptify_variable, #method_missing, #set_property, #to_javascript, #to_json

Constructor Details

#initialize(expr) ⇒ JsExpr

Returns a new instance of JsExpr.



118
119
120
# File 'lib/map_layers/js_wrapper.rb', line 118

def initialize(expr)
  @variable = expr
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MapLayers::JsWrapper

Instance Method Details

#createObject

Returns the javascript expression contained in the object.



122
123
124
# File 'lib/map_layers/js_wrapper.rb', line 122

def create
  @variable
end

#to_sObject



125
126
127
# File 'lib/map_layers/js_wrapper.rb', line 125

def to_s
  @variable
end

#to_strObject



128
129
130
# File 'lib/map_layers/js_wrapper.rb', line 128

def to_str
  @variable
end