Class: Nodo::Constant

Inherits:
Object
  • Object
show all
Defined in:
lib/nodo/constant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Constant

Returns a new instance of Constant.



5
6
7
# File 'lib/nodo/constant.rb', line 5

def initialize(name, value)
  @name, @value = name, value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/nodo/constant.rb', line 3

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/nodo/constant.rb', line 3

def value
  @value
end

Instance Method Details

#to_jsObject



9
10
11
# File 'lib/nodo/constant.rb', line 9

def to_js
  "const #{name} =  __nodo_klass__.#{name} = #{value.to_json};\n"
end