Class: Object

Inherits:
BasicObject
Defined in:
lib/flex_array/object.rb

Overview

Extensions to Object needed to support flex array.

Instance Method Summary collapse

Instance Method Details

#to_index_range(spec) ⇒ Object

Convert this object to an range index against the spec.



10
11
12
13
14
15
16
# File 'lib/flex_array/object.rb', line 10

def to_index_range(spec)
  if self == :all
    spec.range
  else
    fail IndexError, "Invalid subscript: #{self.inspect}"
  end
end

#to_spec_component(_stride) ⇒ Object

Fail with message since the array dimension is invalid.



5
6
7
# File 'lib/flex_array/object.rb', line 5

def to_spec_component(_stride)
  fail ArgumentError, "Invalid flex array dimension: #{self.inspect}"
end