Class: Taski::Section

Inherits:
Task
  • Object
show all
Defined in:
lib/taski/section.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#clean, clean, clear_dependency_cache, coordinator, exported_methods, exports, new, registry, reset!, #reset!, run, tree

Class Method Details

.cached_dependenciesObject

Section does not have static dependencies for execution. The impl method is called at runtime to determine the actual implementation. Static dependencies (impl candidates) are only used for tree display and circular detection.



16
17
18
# File 'lib/taski/section.rb', line 16

def cached_dependencies
  Set.new
end

.interfaces(*interface_methods) ⇒ Object

Parameters:

  • interface_methods (Array<Symbol>)

    Names of interface methods



9
10
11
# File 'lib/taski/section.rb', line 9

def interfaces(*interface_methods)
  exports(*interface_methods)
end

Instance Method Details

#implClass

Returns The implementation task class.

Returns:

  • (Class)

    The implementation task class

Raises:

  • (NotImplementedError)

    If not implemented by subclass



37
38
39
# File 'lib/taski/section.rb', line 37

def impl
  raise NotImplementedError, "Subclasses must implement the impl method to return implementation class"
end

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/taski/section.rb', line 21

def run
  implementation_class = impl
  unless implementation_class
    raise "Section #{self.class} does not have an implementation. Override 'impl' method."
  end

  apply_interface_to_implementation(implementation_class)

  self.class.exported_methods.each do |method|
    value = implementation_class.public_send(method)
    instance_variable_set("@#{method}", value)
  end
end