Class: Rubycritic::Smell
- Inherits:
-
Object
- Object
- Rubycritic::Smell
- Defined in:
- lib/rubycritic/core/smell.rb
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #at_location?(other_location) ⇒ Boolean
- #hash ⇒ Object
- #multiple_locations? ⇒ Boolean
- #to_h ⇒ Object
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
24 25 26 |
# File 'lib/rubycritic/core/smell.rb', line 24 def ==(other) state == other.state end |
#at_location?(other_location) ⇒ Boolean
16 17 18 |
# File 'lib/rubycritic/core/smell.rb', line 16 def at_location?(other_location) locations.any? { |location| location == other_location } end |
#hash ⇒ Object
49 50 51 |
# File 'lib/rubycritic/core/smell.rb', line 49 def hash state.hash end |
#multiple_locations? ⇒ Boolean
20 21 22 |
# File 'lib/rubycritic/core/smell.rb', line 20 def multiple_locations? locations.length > 1 end |
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rubycritic/core/smell.rb', line 33 def to_h { context: context, cost: cost, locations: locations, message: , score: score, status: status, type: type } end |
#to_json(*a) ⇒ Object
45 46 47 |
# File 'lib/rubycritic/core/smell.rb', line 45 def to_json(*a) to_h.to_json(*a) end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/rubycritic/core/smell.rb', line 29 def to_s "(#{type}) #{context} #{}" end |