Class: Rubycritic::Smell

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/smell.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



29
30
31
# File 'lib/rubycritic/smell.rb', line 29

def <=>(other)
  locations <=> other.locations
end

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



24
25
26
# File 'lib/rubycritic/smell.rb', line 24

def ==(other)
  self.class == other.class && state == other.state
end

#hashObject



37
38
39
# File 'lib/rubycritic/smell.rb', line 37

def hash
  state.hash
end

#located_in?(other_location) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rubycritic/smell.rb', line 20

def located_in?(other_location)
  locations.any? { |location| location == other_location }
end

#pathnamesObject



16
17
18
# File 'lib/rubycritic/smell.rb', line 16

def pathnames
  @pathnames ||= locations.map(&:pathname).uniq
end

#to_sObject



33
34
35
# File 'lib/rubycritic/smell.rb', line 33

def to_s
  "(#{type}) #{context} #{message}"
end