Module: Spandx::Core::Registerable

Includes:
Enumerable
Included in:
Spandx::Cli::Printer, Gateway, Parser, Plugin
Defined in:
lib/spandx/core/registerable.rb

Instance Method Summary collapse

Instance Method Details

#allObject



8
9
10
# File 'lib/spandx/core/registerable.rb', line 8

def all
  @all ||= registry.map(&:new)
end

#each(&block) ⇒ Object



12
13
14
15
16
# File 'lib/spandx/core/registerable.rb', line 12

def each(&block)
  all.each do |x|
    block.call(x)
  end
end

#inherited(subclass) ⇒ Object



18
19
20
# File 'lib/spandx/core/registerable.rb', line 18

def inherited(subclass)
  registry.push(subclass)
end

#registryObject



22
23
24
# File 'lib/spandx/core/registerable.rb', line 22

def registry
  @registry ||= []
end