Class: Range

Inherits:
Object show all
Defined in:
lib/origen/core_ext/range.rb

Instance Method Summary collapse

Instance Method Details

#reverseObject



2
3
4
5
6
# File 'lib/origen/core_ext/range.rb', line 2

def reverse
  first = self.first
  last = self.last
  last..first
end

#to_aObject



8
9
10
11
12
13
14
15
# File 'lib/origen/core_ext/range.rb', line 8

def to_a
  a = super
  if a.empty?
    reverse.to_a.reverse
  else
    a
  end
end