Class: Hocon::Impl::Tokens::Problem

Inherits:
Token
  • Object
show all
Defined in:
lib/hocon/impl/tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(origin, what, message, suggest_quotes, cause) ⇒ Problem

Returns a new instance of Problem.



137
138
139
140
141
142
143
# File 'lib/hocon/impl/tokens.rb', line 137

def initialize(origin, what, message, suggest_quotes, cause)
  super(TokenType::PROBLEM, origin)
  @what = what
  @message = message
  @suggest_quotes = suggest_quotes
  @cause = cause
end

Instance Method Details

#==(other) ⇒ Object



176
177
178
179
180
181
# File 'lib/hocon/impl/tokens.rb', line 176

def ==(other)
  super(other) && other.what == @what &&
      other.message == @message &&
      other.suggest_quotes == @suggest_quotes &&
      Hocon::Impl::ConfigImplUtil.equals_handling_nil?(other.cause, @cause)
end

#can_equal(other) ⇒ Object



172
173
174
# File 'lib/hocon/impl/tokens.rb', line 172

def can_equal(other)
  other.is_a?(Problem)
end

#causeObject



157
158
159
# File 'lib/hocon/impl/tokens.rb', line 157

def cause
  @cause
end

#hashObject



183
184
185
186
187
188
189
190
191
192
193
# File 'lib/hocon/impl/tokens.rb', line 183

def hash
  hashcode = 41 * (41 + super)
  hashcode = 41 * (hashcode + @what.hash)
  hashcode = 41 * (hashcode + @message.hash)
  hashcode = 41 * (hashcode + @suggest_quotes.hash)
  unless @cause.nil?
    hashcode = 41 * (hashcode + @cause.hash)
  end

  hashcode
end

#messageObject



149
150
151
# File 'lib/hocon/impl/tokens.rb', line 149

def message
  @message
end

#suggest_quotesObject



153
154
155
# File 'lib/hocon/impl/tokens.rb', line 153

def suggest_quotes
  @suggest_quotes
end

#to_sObject



161
162
163
164
165
166
167
168
169
170
# File 'lib/hocon/impl/tokens.rb', line 161

def to_s
  sb = StringIO.new
  sb << "'"
  sb << what
  sb << "'"
  sb << " ("
  sb << message
  sb << ")"
  sb.string
end

#whatObject



145
146
147
# File 'lib/hocon/impl/tokens.rb', line 145

def what
  @what
end