Class: Hocon::Impl::Tokens::Comment
- Inherits:
-
Token
- Object
- Hocon::Impl::Tokens::Comment
show all
- Defined in:
- lib/hocon/impl/tokens.rb
Defined Under Namespace
Classes: DoubleSlashComment, HashComment
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(origin, text) ⇒ Comment
Returns a new instance of Comment.
197
198
199
200
|
# File 'lib/hocon/impl/tokens.rb', line 197
def initialize(origin, text)
super(TokenType::COMMENT, origin)
@text = text
end
|
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
222
223
224
|
# File 'lib/hocon/impl/tokens.rb', line 222
def text
@text
end
|
Instance Method Details
#==(other) ⇒ Object
236
237
238
|
# File 'lib/hocon/impl/tokens.rb', line 236
def ==(other)
super(other) && other.text == @text
end
|
#can_equal(other) ⇒ Object
232
233
234
|
# File 'lib/hocon/impl/tokens.rb', line 232
def can_equal(other)
other.is_a?(Comment)
end
|
#hash ⇒ Object
240
241
242
243
244
245
|
# File 'lib/hocon/impl/tokens.rb', line 240
def hash
hashcode = 41 * (41 + super)
hashcode = 41 * (hashcode + @text.hash)
hashcode
end
|
#to_s ⇒ Object
224
225
226
227
228
229
230
|
# File 'lib/hocon/impl/tokens.rb', line 224
def to_s
sb = StringIO.new
sb << "'#"
sb << text
sb << "' (COMMENT)"
sb.string
end
|