Class: Croudia::Cursor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], attr_object_reader, attr_reader, #attrs, #inspect

Constructor Details

#initialize(key, klass, attrs) ⇒ Cursor

Returns a new instance of Cursor.



12
13
14
15
16
17
18
19
# File 'lib/croudia/cursor.rb', line 12

def initialize(key, klass, attrs)
  if klass.is_a?(Class)
    singleton_class.attr_object_reader(key => Array(klass))
  else
    singleton_class.attr_reader(key)
  end
  super(attrs)
end

Instance Attribute Details

#next_cursorObject (readonly)

Returns the value of attribute next_cursor.



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

def next_cursor
  @next_cursor
end

#next_cursor_strObject (readonly)

Returns the value of attribute next_cursor_str.



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

def next_cursor_str
  @next_cursor_str
end

#previous_cursorObject (readonly)

Returns the value of attribute previous_cursor.



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

def previous_cursor
  @previous_cursor
end

#previous_cursor_strObject (readonly)

Returns the value of attribute previous_cursor_str.



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

def previous_cursor_str
  @previous_cursor_str
end

Instance Method Details

#first?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/croudia/cursor.rb', line 21

def first?
  previous_cursor.zero?
end

#last?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/croudia/cursor.rb', line 25

def last?
  next_cursor.zero?
end