Class: Postscript::Model::Literals::StringLiteral

Inherits:
Object
  • Object
show all
Defined in:
lib/postscript/model/literals/string.rb

Overview

Parenthesized string literal: (foo bar baz).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ StringLiteral

Returns a new instance of StringLiteral.



10
11
12
13
# File 'lib/postscript/model/literals/string.rb', line 10

def initialize(value)
  @value = value.to_s
  freeze
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/postscript/model/literals/string.rb', line 8

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



19
20
21
# File 'lib/postscript/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/postscript/model/literals/string.rb', line 15

def accept(visitor, ctx)
  visitor.visit_string_literal(self, ctx)
end

#hashObject



24
25
26
# File 'lib/postscript/model/literals/string.rb', line 24

def hash
  value.hash
end