Class: Nodo::Constant
- Inherits:
-
Object
- Object
- Nodo::Constant
- Defined in:
- lib/nodo/constant.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value) ⇒ Constant
constructor
A new instance of Constant.
- #to_js ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/nodo/constant.rb', line 3 def name @name end |
#value ⇒ Object (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_js ⇒ Object
9 10 11 |
# File 'lib/nodo/constant.rb', line 9 def to_js "const #{name} = __nodo_klass__.#{name} = #{value.to_json};\n" end |