Class: NSArray
- Inherits:
-
Object
- Object
- NSArray
- Includes:
- Accessibility::NSArrayCompat
- Defined in:
- lib/ax_elements/nsarray_compat.rb
Overview
AXElements extensions for NSArray
Class Method Summary collapse
-
.array ⇒ Array
Create and return a new empty array.
-
.arrayWithArray(ary) ⇒ Object
Create a new array with the same contents as the given array.
Instance Method Summary collapse
-
#fifth ⇒ Object
Equal to
self[4]
. -
#forty_two ⇒ Object
(also: #the_reddit)
Equal to
self[41]
. -
#fourth ⇒ Object
Equal to
self[3]
. -
#from(position) ⇒ Array
Returns the tail of the array from
position
. -
#second ⇒ Object
Equal to
self[1]
. -
#third ⇒ Object
Equal to
self[2]
. -
#to(count) ⇒ Array
Returns the beginning of the array up to
position
.
Methods included from Accessibility::NSArrayCompat
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Accessibility::NSArrayCompat
Class Method Details
.array ⇒ Array
Create and return a new empty array
137 138 139 |
# File 'lib/ax_elements/nsarray_compat.rb', line 137 def self.array [] end |
.arrayWithArray(ary) ⇒ Object
Create a new array with the same contents as the given array
129 130 131 |
# File 'lib/ax_elements/nsarray_compat.rb', line 129 def self.arrayWithArray ary ary.dup end |
Instance Method Details
#fifth ⇒ Object
Equal to self[4]
111 112 113 |
# File 'lib/ax_elements/nsarray_compat.rb', line 111 def fifth self[4] end |
#forty_two ⇒ Object Also known as: the_reddit
Equal to self[41]
Also known as accessing "the reddit".
119 120 121 |
# File 'lib/ax_elements/nsarray_compat.rb', line 119 def forty_two self[41] end |
#fourth ⇒ Object
Equal to self[3]
105 106 107 |
# File 'lib/ax_elements/nsarray_compat.rb', line 105 def fourth self[3] end |
#from(position) ⇒ Array
Returns the tail of the array from position
73 74 75 |
# File 'lib/ax_elements/nsarray_compat.rb', line 73 def from position self[position, length] || [] end |
#second ⇒ Object
Equal to self[1]
93 94 95 |
# File 'lib/ax_elements/nsarray_compat.rb', line 93 def second self[1] end |
#third ⇒ Object
Equal to self[2]
99 100 101 |
# File 'lib/ax_elements/nsarray_compat.rb', line 99 def third self[2] end |
#to(count) ⇒ Array
Returns the beginning of the array up to position
[1, 2, 3, 4].to(0) # => [1] [1, 2, 3, 4].to(2) # => [1, 2, 3] [1, 2, 3, 4].to(10) # => [1, 2, 3, 4] [].to(0) # => []
87 88 89 |
# File 'lib/ax_elements/nsarray_compat.rb', line 87 def to count take count + 1 end |