Class: NSArray
- Inherits:
-
Object
- Object
- NSArray
- Includes:
- Accessibility::NSArrayCompat
- Defined in:
- lib/ax_elements/nsarray_compat.rb
Overview
AXElements extensions for NSArray
Constant Summary
Class Method Summary (collapse)
-
+ (Array) array
Create and return a new empty array.
-
+ (Object) arrayWithArray(ary)
Create a new array with the same contents as the given array.
Instance Method Summary (collapse)
-
- (Object) fifth
Equal to
self[4]. -
- (Object) forty_two
(also: #the_reddit)
Equal to
self[41]. -
- (Object) fourth
Equal to
self[3]. -
- (Array) from(position)
Returns the tail of the array from
position. -
- (Object) second
Equal to
self[1]. -
- (Object) third
Equal to
self[2]. -
- (Array) to(count)
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 |
+ (Object) arrayWithArray(ary)
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
- (Object) fifth
Equal to self[4]
111 112 113 |
# File 'lib/ax_elements/nsarray_compat.rb', line 111 def fifth self[4] end |
- (Object) forty_two 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 |
- (Object) fourth
Equal to self[3]
105 106 107 |
# File 'lib/ax_elements/nsarray_compat.rb', line 105 def fourth self[3] end |
- (Array) from(position)
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 |
- (Object) second
Equal to self[1]
93 94 95 |
# File 'lib/ax_elements/nsarray_compat.rb', line 93 def second self[1] end |
- (Object) third
Equal to self[2]
99 100 101 |
# File 'lib/ax_elements/nsarray_compat.rb', line 99 def third self[2] end |
- (Array) to(count)
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 |