Class: Minjs::ECMA262::SingleLineComment

Inherits:
Literal
  • Object
show all
Defined in:
lib/minjs/ecma262/lit.rb

Instance Method Summary collapse

Methods inherited from Literal

#lt?, #priority, #to_exp?

Methods inherited from Base

#concat, #deep_dup, #replace, #to_s

Constructor Details

#initialize(comment) ⇒ SingleLineComment

Returns a new instance of SingleLineComment.



545
546
547
# File 'lib/minjs/ecma262/lit.rb', line 545

def initialize(comment)
  @comment = comment
end

Instance Method Details

#==(obj) ⇒ Object



552
553
554
555
# File 'lib/minjs/ecma262/lit.rb', line 552

def ==(obj)
  self.class == obj.class and
    @comment == obj.comment
end

#to_js(options) ⇒ Object



557
558
559
# File 'lib/minjs/ecma262/lit.rb', line 557

def to_js(options)
  "//#{@comment}"
end

#traverse(parent, &block) ⇒ Object



549
550
# File 'lib/minjs/ecma262/lit.rb', line 549

def traverse(parent, &block)
end

#ws?Boolean

Returns:



561
562
563
# File 'lib/minjs/ecma262/lit.rb', line 561

def ws?
  true
end