Class: TTK::Strategies::Import

Inherits:
Proxy show all
Includes:
Concrete
Defined in:
lib/ttk/strategies/Import.rb

Instance Attribute Summary

Attributes inherited from Strategy

#status, #symtbl

Instance Method Summary collapse

Methods inherited from Proxy

#create

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

#import=(aPath) ⇒ Object



29
30
31
32
# File 'lib/ttk/strategies/Import.rb', line 29

def import= ( aPath )
  @import = aPath
  @import = Pathname.new(aPath) unless aPath.is_a? Pathname
end

#loader=(aLoader) ⇒ Object



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

def loader= ( aLoader )
  @loader = Loaders.const_get(aLoader).new
end

#prologueObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ttk/strategies/Import.rb', line 14

def prologue 
  super
  unless @import.exist?
    raise ArgumentError, "the import file must exits (#@import)"
  end
  unless @loader.nil?
    save_loader = @symtbl[:loader]
    @symtbl[:loader] = @loader
  end
  create(@import) do |t|
    t.symtbl[:loader] = @symtbl[:loader]
  end
  @symtbl[:loader] = save_loader unless @loader.nil?
end