Method: Range#heach
- Defined in:
- lib/HDLRuby/hruby_high.rb
#heach(&ruby_block) ⇒ Object
Iterates over the range as hardware.
Returns an enumerator if no ruby block is given.
5424 5425 5426 5427 5428 5429 5430 5431 5432 |
# File 'lib/HDLRuby/hruby_high.rb', line 5424 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 |