Class: Uttk::Strategies::Composite

Inherits:
Strategy show all
Includes:
Abstract
Defined in:
lib/uttk/strategies/Composite.rb

Overview

I’m the super class of every strategy class that are composed by other strategies.

Direct Known Subclasses

Collection, PackageCollection, Proxy

Defined Under Namespace

Modules: Ordered

Instance Attribute Summary

Attributes inherited from Strategy

#status

Instance Method Summary collapse

Methods inherited from Strategy

#abort, #assert_cmd, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize_flow_factory, #mk_system_runner, #name=, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #skip_pass, #skip_wrt_rpath_and_rpath_exclude, #strategy, #strategy=, #symbols=, #symtbl, #symtbl=, #testify, #timeout=, to_form, #to_s, to_yaml_type, #wclass=

Constructor Details

#initialize(*a, &b) ⇒ Composite

Returns a new instance of Composite.



18
19
20
21
22
# File 'lib/uttk/strategies/Composite.rb', line 18

def initialize ( *a, &b )
  @contents = []
  @status_list = []
  super
end

Instance Method Details

#<<(anObject) ⇒ Object



47
48
49
50
# File 'lib/uttk/strategies/Composite.rb', line 47

def << ( anObject )
  create(anObject)
  self
end

#contents(other = nil, &block) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/uttk/strategies/Composite.rb', line 65

def contents(other=nil, &block)
  if other.nil?
    if block.nil?
      internal_contents
    else
      self.contents = ContentsEval.new(&block).contents
    end
  else
    self.contents = other
  end
end

#create(anObject, &block) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/uttk/strategies/Composite.rb', line 36

def create ( anObject, &block )
  res = anObject.testify(new_symtbl.merge!(testify_options)) do |aTest|
    initialize_test(aTest)
    raise "nil symtbl" if aTest.symtbl.nil?
    block[aTest] if block
  end
  @contents << res
  res
end

#initialize_copy(aTest) ⇒ Object



25
26
27
28
# File 'lib/uttk/strategies/Composite.rb', line 25

def initialize_copy ( aTest )
  super
  aTest.contents = @contents.dup
end

#initialize_test(aTest) ⇒ Object



31
32
33
# File 'lib/uttk/strategies/Composite.rb', line 31

def initialize_test ( aTest )
  aTest.wclass = @wclass
end