Class: HDLRuby::High::Std::TaskPortA
- Inherits:
-
Object
- Object
- HDLRuby::High::Std::TaskPortA
- Defined in:
- lib/HDLRuby/std/task.rb
Overview
Describes an finisher port to a task.
Instance Method Summary collapse
-
#finish(*args, &ruby_block) ⇒ Object
Performs a finish on the task using +args+ and +ruby_block+ as arguments.
-
#initialize(namespace, finisher_proc, reseter_proc = nil) ⇒ TaskPortA
constructor
Creates a new task finisher running in +namespace+ and writing using +finisher_proc+ and reseting using +reseter_proc+.
Constructor Details
#initialize(namespace, finisher_proc, reseter_proc = nil) ⇒ TaskPortA
Creates a new task finisher running in +namespace+ and writing using +finisher_proc+ and reseting using +reseter_proc+.
146 147 148 149 150 151 152 153 |
# File 'lib/HDLRuby/std/task.rb', line 146 def initialize(namespace,finisher_proc,reseter_proc = nil) unless namespace.is_a?(Namespace) raise "Invalid class for a namespace: #{namespace.class}" end @namespace = namespace @finisher_proc = finisher_proc.to_proc # @reseter_proc = reseter_proc ? reseter_proc.to_proc : proc {} end |
Instance Method Details
#finish(*args, &ruby_block) ⇒ Object
Performs a finish on the task using +args+ and +ruby_block+ as arguments.
157 158 159 160 161 162 163 164 165 166 |
# File 'lib/HDLRuby/std/task.rb', line 157 def finish(*args,&ruby_block) # Gain access to the finisher as local variable. finisher_proc = @finisher_proc # Execute the code generating the accesser in context. HDLRuby::High.space_push(@namespace) HDLRuby::High.cur_block.open do instance_exec(ruby_block,*args,&finisher_proc) end HDLRuby::High.space_pop end |