Class: Dat::Analysis::Library

Inherits:
Object
  • Object
show all
Defined in:
lib/dat/analysis/library.rb

Overview

Internal: Keep a registry of Dat::Analysis::Matcher and Dat::Analysis::Result subclasses for use by an Dat::Analysis::Analysis instance.

Constant Summary collapse

@@known_classes =
[]

Class Method Summary collapse

Class Method Details

.add(klass) ⇒ Object

Public: register a matcher or results class.

klass - a Dat::Analysis::Matcher or Dat::Analysis::Result subclass.

Returns the current list of registered classes.



26
27
28
# File 'lib/dat/analysis/library.rb', line 26

def self.add(klass)
  @@known_classes << klass
end

.select_classes(&block) ⇒ Object

Public: Collect matcher and results classes created by the

provided block.

&block - Block which instantiates matcher and results classes.

Returns the newly-instantiated matcher and results classes.



15
16
17
18
19
# File 'lib/dat/analysis/library.rb', line 15

def self.select_classes(&block)
  @@known_classes = [] # prepare for registering new classes
  yield
  @@known_classes # return all the newly-registered classes
end