Class: TTK::Strategies::Block
- Includes:
- Concrete
- Defined in:
- lib/ttk/strategies/Block.rb
Instance Attribute Summary
Attributes inherited from Strategy
Class Method Summary collapse
Instance Method Summary collapse
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::Strategy
Class Method Details
.create(*a, &block) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/ttk/strategies/Block.rb', line 14 def self.create ( *a, &block ) raise ArgumentError, 'need a block' unless block_given? strategy = new(*a) strategy.test = block strategy end |
Instance Method Details
#test=(block1 = nil, &block2) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ttk/strategies/Block.rb', line 21 def test=(block1=nil, &block2) if block_given? @test = block2 elsif !block1.nil? @test = block1 else raise ArgumentError, 'no block given' end if @test.is_a?(String) str = @test.dup @test = proc do eval str end end end |