Class: Minjs::ECMA262::Punctuator
- Defined in:
- lib/minjs/ecma262/punctuator.rb
Overview
ECMA262 punctuator element
Constant Summary collapse
- @@sym =
{}
Instance Attribute Summary collapse
-
#val ⇒ Object
readonly
Returns the value of attribute val.
Attributes inherited from Base
Class Method Summary collapse
-
.get(val) ⇒ Object
Returns punctuator object representation of string.
Instance Method Summary collapse
-
#==(obj) ⇒ Object
Return true if punctuator equals to other.
-
#initialize(val) ⇒ Punctuator
constructor
A new instance of Punctuator.
-
#to_js ⇒ Object
Returns a ECMAScript string containg the representation of element.
-
#to_s ⇒ Object
Returns a string containg the representation of punctuator.
Methods inherited from Literal
#lt?, #priority, #side_effect?, #ws?
Methods inherited from Base
#add_remove_paren, #concat, #deep_dup, #replace, #traverse
Constructor Details
#initialize(val) ⇒ Punctuator
Returns a new instance of Punctuator.
11 12 13 |
# File 'lib/minjs/ecma262/punctuator.rb', line 11 def initialize(val) @val = val.to_sym end |
Instance Attribute Details
#val ⇒ Object (readonly)
Returns the value of attribute val.
7 8 9 |
# File 'lib/minjs/ecma262/punctuator.rb', line 7 def val @val end |
Class Method Details
.get(val) ⇒ Object
Returns punctuator object representation of string.
18 19 20 |
# File 'lib/minjs/ecma262/punctuator.rb', line 18 def self.get(val) @@sym[val] ||= self.new(val) end |
Instance Method Details
#==(obj) ⇒ Object
Return true if punctuator equals to other.
36 37 38 |
# File 'lib/minjs/ecma262/punctuator.rb', line 36 def ==(obj) self.class == obj.class and self.val == obj.val end |
#to_js ⇒ Object
Returns a ECMAScript string containg the representation of element.
29 30 31 |
# File 'lib/minjs/ecma262/punctuator.rb', line 29 def to_js val.to_s end |
#to_s ⇒ Object
Returns a string containg the representation of punctuator.
23 24 25 |
# File 'lib/minjs/ecma262/punctuator.rb', line 23 def to_s val.to_s end |