Class: BufferCursor::StackEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/buffer_cursor.rb

Overview

An entry in a stack of cursors. The cursor position, direction, and name array are each attributes of the current cursor stack and are manipulated together.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cursor, position = 0, direction = :forward, name = nil) ⇒ StackEntry

Returns a new instance of StackEntry.



20
21
22
23
24
25
# File 'lib/buffer_cursor.rb', line 20

def initialize(cursor, position=0, direction=:forward, name=nil)
  @cursor = cursor
  @position = position
  @direction = direction
  @name = name || []
end

Instance Attribute Details

#cursorObject

Returns the value of attribute cursor.



15
16
17
# File 'lib/buffer_cursor.rb', line 15

def cursor
  @cursor
end

#directionObject

Returns the value of attribute direction.



17
18
19
# File 'lib/buffer_cursor.rb', line 17

def direction
  @direction
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/buffer_cursor.rb', line 18

def name
  @name
end

#positionObject

Returns the value of attribute position.



16
17
18
# File 'lib/buffer_cursor.rb', line 16

def position
  @position
end

Instance Method Details

#dupObject



27
28
29
# File 'lib/buffer_cursor.rb', line 27

def dup
  StackEntry.new(cursor, position, direction, name.dup)
end