class Range

Extends the range class to support to_low

Public Instance Methods

heach(&ruby_block) click to toggle source

Iterates over the range as hardware.

Returns an enumerator if no ruby block is given.

# File lib/HDLRuby/hruby_high.rb, line 4684
def heach(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:heach) unless ruby_block
    # Order the bounds to be able to iterate.
    first,last = self.first, self.last
    first,last = first > last ? [last,first] : [first,last]
    # Iterate.
    (first..last).each(&ruby_block)
end
to_low() click to toggle source

Convert the first and last to HDLRuby::Low

# File lib/HDLRuby/hruby_high.rb, line 4673
def to_low
    first = self.first
    first = first.respond_to?(:to_low) ? first.to_low : first
    last = self.last
    last = last.respond_to?(:to_low) ? last.to_low : last
    return (first..last)
end