Class: Hashira::Smells::Ownership

Inherits:
Object
  • Object
show all
Defined in:
lib/hashira/smells/ownership.rb

Instance Method Summary collapse

Constructor Details

#initialize(trees) ⇒ Ownership

Returns a new instance of Ownership.



4
5
6
7
8
# File 'lib/hashira/smells/ownership.rb', line 4

def initialize(trees)
  @suffixes = Set.new
  @tables = {}
  trees.each { survey(it) }
end

Instance Method Details

#keys(segments) ⇒ Object



12
# File 'lib/hashira/smells/ownership.rb', line 12

def keys(segments) = @tables.fetch(segments.join("::"), [])

#owned?(segments) ⇒ Boolean

Returns:

  • (Boolean)


10
# File 'lib/hashira/smells/ownership.rb', line 10

def owned?(segments) = @suffixes.include?(segments.join("::"))