module HDLRuby::High::HRef

Module giving high-level reference properties.

Public Class Methods

included(klass) click to toggle source

Properties of expressions are also required

# File lib/HDLRuby/hruby_high.rb, line 2925
def self.included(klass)
    klass.class_eval do
        include HExpression
        include HArrow

        # Converts to a new expression.
        def to_expr
            self.to_ref
        end
    end
end

Public Instance Methods

each() { |self| ... } click to toggle source

Iterate over the elements.

Returns an enumerator if no ruby block is given.

# File lib/HDLRuby/hruby_high.rb, line 2952
def each(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each) unless ruby_block
    # A block? Apply it on each element.
    self.type.range.heach do |i|
        yield(self[i])
    end
end
to_event() click to toggle source

Converts to a new event.

# File lib/HDLRuby/hruby_high.rb, line 2945
def to_event
    return Event.new(:change,self.to_ref)
end
to_expr() click to toggle source

Converts to a new expression.

# File lib/HDLRuby/hruby_high.rb, line 2931
def to_expr
    self.to_ref
end
to_ref() click to toggle source

Converts to a new reference.

NOTE: to be redefined in case of non-reference class.

# File lib/HDLRuby/hruby_high.rb, line 2940
def to_ref
    raise AnyError, "Internal error: to_ref not defined yet for class: #{self.class}"
end