Class: RubyLint::Report::Entry
- Inherits:
-
Object
- Object
- RubyLint::Report::Entry
- Defined in:
- lib/ruby-lint/report/entry.rb
Overview
Entry contains data about a single report entry such as the message and line number.
Instance Attribute Summary collapse
-
#column ⇒ Numeric
readonly
-
#file ⇒ String
readonly
-
#level ⇒ Symbol
readonly
-
#line ⇒ Numeric
readonly
-
#message ⇒ String
readonly
-
#node ⇒ RubyLint::AST::Node
readonly
Instance Method Summary collapse
-
#<=>(other) ⇒ Numeric
Determines the sort order of the current entry.
-
#attributes ⇒ Hash
Returns a Hash containing the attributes of the entry.
-
#filename ⇒ String
-
#initialize(attributes = {}) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(attributes = {}) ⇒ Entry
Returns a new instance of Entry
31 32 33 34 35 |
# File 'lib/ruby-lint/report/entry.rb', line 31 def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#column ⇒ Numeric (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
#file ⇒ String (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
#level ⇒ Symbol (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
#line ⇒ Numeric (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
#message ⇒ String (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
#node ⇒ RubyLint::AST::Node (readonly)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby-lint/report/entry.rb', line 25 class Entry attr_reader :level, :message, :line, :column, :file, :node ## # @param [Hash] attributes # def initialize(attributes = {}) attributes.each do |key, value| instance_variable_set("@#{key}", value) end end ## # @return [String] # def filename return File.basename(file) end ## # Returns a Hash containing the attributes of the entry. # # @return [Hash] # def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end ## # 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] # def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end end |
Instance Method Details
#<=>(other) ⇒ Numeric
Determines the sort order of the current entry. The entry is sorted based on the filename and the line.
69 70 71 |
# File 'lib/ruby-lint/report/entry.rb', line 69 def <=>(other) [file, line, column] <=> [other.file, other.line, other.column] end |
#attributes ⇒ Hash
Returns a Hash containing the attributes of the entry.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ruby-lint/report/entry.rb', line 49 def attributes return { :level => level, :message => , :line => line, :column => column, :file => file, :filename => filename, :node => node } end |
#filename ⇒ String
40 41 42 |
# File 'lib/ruby-lint/report/entry.rb', line 40 def filename return File.basename(file) end |