Class: Cursor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, visible) ⇒ Cursor

Returns a new instance of Cursor.



5
6
7
# File 'lib/asciinema/cursor.rb', line 5

def initialize(x, y, visible)
  @x, @y, @visible = x, y, visible
end

Instance Attribute Details

#visibleObject (readonly)

Returns the value of attribute visible.



3
4
5
# File 'lib/asciinema/cursor.rb', line 3

def visible
  @visible
end

#xObject (readonly)

Returns the value of attribute x.



3
4
5
# File 'lib/asciinema/cursor.rb', line 3

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



3
4
5
# File 'lib/asciinema/cursor.rb', line 3

def y
  @y
end

Instance Method Details

#diff(other) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/asciinema/cursor.rb', line 9

def diff(other)
  diff = {}
  diff[:x] = x if other && x != other.x || other.nil?
  diff[:y] = y if other && y != other.y || other.nil?
  diff[:visible] = visible if other && visible != other.visible || other.nil?

  diff
end