Class: Paginator::Cursor

Inherits:
Object
  • Object
show all
Defined in:
lib/appengine-paginator/cursor.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cursor) ⇒ Cursor

Returns a new instance of Cursor.



4
5
6
# File 'lib/appengine-paginator/cursor.rb', line 4

def initialize(cursor)
  @_cursor = cursor
end

Class Method Details

.parse(cursor_string) ⇒ Object

Converts the cursor from a base 64 encoded string and returns the cursor object

  • must be a base 64 encoded cursor



17
18
19
20
21
22
23
# File 'lib/appengine-paginator/cursor.rb', line 17

def self.parse(cursor_string)
  if cursor_string.nil?
    nil
  else
    Cursor.new Java::comGoogleAppengineApiDatastore::Cursor.from_web_safe_string(cursor_string)
  end
end

Instance Method Details

#to_javaObject

returns the actual Java cursor (instance of com.google.appengine.api.datastore.Cursor



26
27
28
# File 'lib/appengine-paginator/cursor.rb', line 26

def to_java
  @_cursor
end

#to_sObject

Converts the cursor to a string encoded in base64.



9
10
11
# File 'lib/appengine-paginator/cursor.rb', line 9

def to_s
  @_cursor.to_web_safe_string
end