Class: Puppet::Pops::Validation::Diagnostic Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/validation.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(severity, issue, file, source_pos, arguments = {}, exception = nil) ⇒ Diagnostic

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Diagnostic.



235
236
237
238
239
240
241
242
243
244
# File 'lib/puppet/pops/validation.rb', line 235

def initialize severity, issue, file, source_pos, arguments={}, exception=nil
  @severity = severity
  @issue = issue
  @file = file
  @source_pos = source_pos
  @arguments = arguments
  # TODO: Currently unused, the intention is to provide more information (stack backtrace, etc.) when
  # debugging or similar - this to catch internal problems reported as higher level issues.
  @exception = exception
end

Instance Attribute Details

#argumentsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



231
232
233
# File 'lib/puppet/pops/validation.rb', line 231

def arguments
  @arguments
end

#exceptionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



232
233
234
# File 'lib/puppet/pops/validation.rb', line 232

def exception
  @exception
end

#fileObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



233
234
235
# File 'lib/puppet/pops/validation.rb', line 233

def file
  @file
end

#issueObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



230
231
232
# File 'lib/puppet/pops/validation.rb', line 230

def issue
  @issue
end

#severityObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



229
230
231
# File 'lib/puppet/pops/validation.rb', line 229

def severity
  @severity
end

#source_posObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



234
235
236
# File 'lib/puppet/pops/validation.rb', line 234

def source_pos
  @source_pos
end

Instance Method Details

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Two diagnostics are considered equal if the have the same issue, location and severity (arguments and exception are ignored)



249
250
251
252
253
254
255
# File 'lib/puppet/pops/validation.rb', line 249

def ==(o)
  self.class            == o.class             &&
    same_position?(o)                          &&
    issue.issue_code    == o.issue.issue_code  &&
    file                == o.file              &&
    severity            == o.severity
end

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



264
265
266
# File 'lib/puppet/pops/validation.rb', line 264

def hash
  @hash ||= [file, source_pos.offset, issue.issue_code, severity].hash
end