Class: TTK::Strategies::Glob

Inherits:
Composite show all
Includes:
Concrete
Defined in:
lib/ttk/strategies/Glob.rb

Overview

The Glob strategy collects a set of files using a globing expression, bundles them in a Composite strategy and finally run them sequentially.

Instance Attribute Summary

Attributes inherited from Strategy

#status, #symtbl

Instance Method Summary collapse

Methods inherited from Composite

#<<, #create, #initialize, #initialize_test, #new_symtbl

Methods inherited from Strategy

#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #strategy, #strategy=, #symbols=, #testify, #timeout=, #to_s, #wclass=

Constructor Details

This class inherits a constructor from TTK::Strategies::Composite

Instance Method Details

#prologueObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ttk/strategies/Glob.rb', line 16

def prologue
  super
  Dir[@glob].each do |file|
	  create(@test) do |t|
      # Symtbl must be filled before the test attributes initialization
      if file =~ @regexp
        t.symtbl[:match] = $1
      else
        raise ArgumentError,
              "Path name (#{file}) doesn't match the regexp (#@regexp)"
      end
      t.symtbl[:path] = file
    end
  end
end

#regexp=(aRegexp) ⇒ Object



33
34
35
36
# File 'lib/ttk/strategies/Glob.rb', line 33

def regexp= ( aRegexp )
  @regexp = aRegexp
	@regexp = Regexp.new(aRegexp) unless aRegexp.is_a? Regexp
end