Class: Range
- Inherits:
- 
      Object
      
        - Object
- Range
 
- Defined in:
- lib/HDLRuby/hruby_high.rb
Overview
Extends the range class to support to_low
Instance Method Summary collapse
- 
  
    
      #heach(&ruby_block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Iterates over the range as hardware. 
- 
  
    
      #to_low  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Convert the first and last to HDLRuby::Low. 
Instance Method Details
#heach(&ruby_block) ⇒ Object
Iterates over the range as hardware.
Returns an enumerator if no ruby block is given.
| 5101 5102 5103 5104 5105 5106 5107 5108 5109 | # File 'lib/HDLRuby/hruby_high.rb', line 5101 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 ⇒ Object
Convert the first and last to HDLRuby::Low
| 5090 5091 5092 5093 5094 5095 5096 | # File 'lib/HDLRuby/hruby_high.rb', line 5090 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 |