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.



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

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



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

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



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

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

#causeObject



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

def cause
  @cause
end

#hashObject



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

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



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

def message
  @message
end

#suggest_quotesObject



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

def suggest_quotes
  @suggest_quotes
end

#to_sObject



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

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

#whatObject



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

def what
  @what
end