Class: Range
- Defined in:
- lib/accessibility/bridge/macruby.rb,
lib/accessibility/bridge/mri.rb
Overview
accessibility-core
extensions to the Range
class
Instance Method Summary collapse
-
#relative_to(max) ⇒ Range
Returns a new Range instance which has negative values in the receiver expanded relative to
max
. - #to_ax ⇒ AXValueRef
Instance Method Details
#relative_to(max) ⇒ Range
Returns a new Range instance which has negative values in
the receiver expanded relative to max
211 212 213 214 215 216 |
# File 'lib/accessibility/bridge/mri.rb', line 211 def relative_to max beg = adjust_index self.begin, max len = adjust_index self.end, max len -= 1 if exclude_end? beg..len end |
#to_ax ⇒ AXValueRef
84 85 86 87 88 89 90 91 92 |
# File 'lib/accessibility/bridge/macruby.rb', line 84 def to_ax raise ArgumentError, "can't convert negative index" if last < 0 || first < 0 length = if exclude_end? last - first else last - first + 1 end CFRange.new(first, length).to_ax end |