Class: Postsvg::Model::Literals::StringLiteral
- Inherits:
-
Object
- Object
- Postsvg::Model::Literals::StringLiteral
- Defined in:
- lib/postsvg/model/literals/string.rb
Overview
Parenthesized string literal: (foo bar baz).
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #accept(visitor, ctx) ⇒ Object
- #hash ⇒ Object
-
#initialize(value) ⇒ StringLiteral
constructor
A new instance of StringLiteral.
Constructor Details
#initialize(value) ⇒ StringLiteral
Returns a new instance of StringLiteral.
10 11 12 13 |
# File 'lib/postsvg/model/literals/string.rb', line 10 def initialize(value) @value = value.to_s freeze end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/postsvg/model/literals/string.rb', line 8 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
19 20 21 |
# File 'lib/postsvg/model/literals/string.rb', line 19 def ==(other) other.is_a?(StringLiteral) && other.value == value end |
#accept(visitor, ctx) ⇒ Object
15 16 17 |
# File 'lib/postsvg/model/literals/string.rb', line 15 def accept(visitor, ctx) visitor.visit_string_literal(self, ctx) end |
#hash ⇒ Object
24 25 26 |
# File 'lib/postsvg/model/literals/string.rb', line 24 def hash value.hash end |