class Accessory::TraversalPosition::EnumerableAtOffset
Represents an element encountered during #each
traversal of an Enumerable
.
Attributes
elem_at[R]
@return [Object] the element under the cursor, if applicable
offset[R]
@return [Integer] the offset of elem_at
in the Enumerable
Public Class Methods
new(offset, elem_at, is_first: false, is_last: false)
click to toggle source
@!visibility private
# File lib/accessory/traversal_position/enumerable_at_offset.rb, line 10 def initialize(offset, elem_at, is_first: false, is_last: false) @offset = offset @elem_at = elem_at @is_first = is_first @is_last = is_last end
Public Instance Methods
first?()
click to toggle source
@return [Boolean] true when {#elem_at} is the first element of the Enumerable
# File lib/accessory/traversal_position/enumerable_at_offset.rb, line 24 def first?; @is_first; end
last?()
click to toggle source
@return [Boolean] true when {#elem_at} is the last element of the Enumerable
# File lib/accessory/traversal_position/enumerable_at_offset.rb, line 27 def last?; @is_last; end