Module: Laborantin::Metaprog::Selector::ClassMethods

Defined in:
lib/laborantin/core/selector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#selectorsObject

A hash with two items, this might change later but KISS for now.



11
12
13
# File 'lib/laborantin/core/selector.rb', line 11

def selectors
  @selectors
end

Instance Method Details

#select(sym, ary = [], &blk) ⇒ Object

Add a selector to filter for the analysis only the runs that pass the selector.

  • sym objects (sym currently must be :environments or

:scenarii).

  • ary is a set of classes, only runs of this classes will be loaded

  • if a block is passed, only the instances for which the block is

evaluated as true will be selected (the block must take one parameter: the tested instance)



20
21
22
23
# File 'lib/laborantin/core/selector.rb', line 20

def select(sym, ary=[], &blk) 
  @selectors ||= {} 
  @selectors[sym] = {:klasses => ary, :blk => blk} 
end