class RubyLint::Report::Entry

{RubyLint::Report::Entry} contains data about a single report entry such as the message and line number.

@!attribute [r] level

@return [Symbol]

@!attribute [r] message

@return [String]

@!attribute [r] line

@return [Numeric]

@!attribute [r] column

@return [Numeric]

@!attribute [r] file

@return [String]

@!attribute [r] node

@return [RubyLint::AST::Node]

Attributes

column[R]
file[R]
level[R]
line[R]
message[R]
node[R]

Public Class Methods

new(attributes = {}) click to toggle source

@param [Hash] attributes

# File lib/ruby-lint/report/entry.rb, line 31
def initialize(attributes = {})
  attributes.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Public Instance Methods

<=>(other) click to toggle source

Determines the sort order of the current entry. The entry is sorted based on the filename and the line.

@param [RubyLint::Report::Entry] other The entry to compare with the

current one.

@return [Numeric]

# File lib/ruby-lint/report/entry.rb, line 69
def <=>(other)
  [file, line, column] <=> [other.file, other.line, other.column]
end
attributes() click to toggle source

Returns a Hash containing the attributes of the entry.

@return [Hash]

# File lib/ruby-lint/report/entry.rb, line 49
def attributes
  return {
    :level    => level,
    :message  => message,
    :line     => line,
    :column   => column,
    :file     => file,
    :filename => filename,
    :node     => node
  }
end
filename() click to toggle source

@return [String]

# File lib/ruby-lint/report/entry.rb, line 40
def filename
  return File.basename(file)
end