class HDLRuby::High::Std::TaskPortS

Describes a runner port to a task.

Public Class Methods

new(namespace,runner_proc,reseter_proc = nil) click to toggle source

Creates a new task runner running in namespace and reading using runner_proc and reseting using reseter_proc.

# 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

Public Instance Methods

reset(*args,&ruby_block) click to toggle source

Performs a reset on the task using args and ruby_block as arguments.

# 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) click to toggle source

Performs a run on the task using args and ruby_block as arguments.

# 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