Class: Paginator::Cursor
- Inherits:
-
Object
- Object
- Paginator::Cursor
- Defined in:
- lib/appengine-paginator/cursor.rb
Class Method Summary collapse
-
.parse(cursor_string) ⇒ Object
Converts the cursor from a base 64 encoded string and returns the cursor object.
Instance Method Summary collapse
-
#initialize(cursor) ⇒ Cursor
constructor
A new instance of Cursor.
-
#to_java ⇒ Object
returns the actual Java cursor (instance of com.google.appengine.api.datastore.Cursor.
-
#to_s ⇒ Object
Converts the cursor to a string encoded in base64.
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_java ⇒ Object
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_s ⇒ Object
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 |