Class: Hashira::Smells::Refs
- Inherits:
-
Object
- Object
- Hashira::Smells::Refs
- Defined in:
- lib/hashira/smells/refs.rb
Constant Summary collapse
- SELVES =
[ Prism::SelfNode, Prism::SuperNode, Prism::ForwardingSuperNode, Prism::InstanceVariableReadNode, Prism::InstanceVariableWriteNode, Prism::InstanceVariableOrWriteNode, Prism::InstanceVariableAndWriteNode, Prism::InstanceVariableOperatorWriteNode, Prism::InstanceVariableTargetNode ].freeze
Instance Method Summary collapse
- #ego ⇒ Object
- #envious ⇒ Object
-
#initialize(def_node) ⇒ Refs
constructor
A new instance of Refs.
- #lines(name) ⇒ Object
Constructor Details
Instance Method Details
#ego ⇒ Object
18 |
# File 'lib/hashira/smells/refs.rb', line 18 def ego = lines(:self).size |
#envious ⇒ Object
22 23 24 25 26 |
# File 'lib/hashira/smells/refs.rb', line 22 def envious peak = @tallies.values.map(&:size).max names = @tallies.filter_map { |name, sightings| name if sightings.size == peak } names.include?(:self) ? [] : names end |
#lines(name) ⇒ Object
20 |
# File 'lib/hashira/smells/refs.rb', line 20 def lines(name) = @tallies.fetch(name, []) |