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?
25 26 27 |
# File 'lib/rubycritic/core/smell.rb', line 25 def ==(other) state == other.state end |
#at_location?(other_location) ⇒ Boolean
17 18 19 |
# File 'lib/rubycritic/core/smell.rb', line 17 def at_location?(other_location) locations.any? { |location| location == other_location } end |
#hash ⇒ Object
50 51 52 |
# File 'lib/rubycritic/core/smell.rb', line 50 def hash state.hash end |
#multiple_locations? ⇒ Boolean
21 22 23 |
# File 'lib/rubycritic/core/smell.rb', line 21 def multiple_locations? locations.length > 1 end |
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rubycritic/core/smell.rb', line 34 def to_h { :context => context, :cost => cost, :locations => locations, :message => , :score => score, :status => status, :type => type } end |
#to_json(*a) ⇒ Object
46 47 48 |
# File 'lib/rubycritic/core/smell.rb', line 46 def to_json(*a) to_h.to_json(*a) end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/rubycritic/core/smell.rb', line 30 def to_s "(#{type}) #{context} #{}" end |