Class: HDLRuby::High::Std::TaskPortS
- Inherits:
-
Object
- Object
- HDLRuby::High::Std::TaskPortS
- Defined in:
- lib/HDLRuby/std/task.rb
Overview
Describes a runner port to a task.
Instance Method Summary collapse
-
#initialize(namespace, runner_proc, reseter_proc = nil) ⇒ TaskPortS
constructor
Creates a new task runner running in +namespace+ and reading using +runner_proc+ and reseting using +reseter_proc+.
-
#reset(*args, &ruby_block) ⇒ Object
Performs a reset on the task using +args+ and +ruby_block+ as arguments.
-
#run(*args, &ruby_block) ⇒ Object
Performs a run on the task using +args+ and +ruby_block+ as arguments.
Constructor Details
#initialize(namespace, runner_proc, reseter_proc = nil) ⇒ TaskPortS
Creates a new task runner running in +namespace+ and reading using +runner_proc+ and reseting using +reseter_proc+.
102 103 104 105 106 107 108 109 |
# File 'lib/HDLRuby/std/task.rb', line 102 def initialize(namespace,runner_proc,reseter_proc = nil) unless namespace.is_a?(Namespace) raise "Invalid class for a namespace: #{namespace.class}" end @namespace = namespace @runner_proc = runner_proc.to_proc @rester_proc = reseter_proc ? reseter_proc.to_proc : proc {} end |
Instance Method Details
#reset(*args, &ruby_block) ⇒ Object
Performs a reset on the task using +args+ and +ruby_block+ as arguments.
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/HDLRuby/std/task.rb', line 126 def reset(*args,&ruby_block) # Gain access to the accesser as local variable. reseter_proc = @reseter_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,&reseter_proc) end HDLRuby::High.space_pop end |
#run(*args, &ruby_block) ⇒ Object
Performs a run on the task using +args+ and +ruby_block+ as arguments.
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/HDLRuby/std/task.rb', line 113 def run(*args,&ruby_block) # Gain access to the runner as local variable. runner_proc = @runner_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,&runner_proc) end HDLRuby::High.space_pop end |