Class: ActiveRecord::Cursor::Params
- Inherits:
-
Object
- Object
- ActiveRecord::Cursor::Params
- Defined in:
- lib/activerecord/cursor/params.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
Class Method Summary collapse
Instance Method Summary collapse
- #encoded ⇒ Object
-
#initialize(cursor) ⇒ Params
constructor
A new instance of Params.
- #value ⇒ Object
Constructor Details
#initialize(cursor) ⇒ Params
Returns a new instance of Params.
6 7 8 |
# File 'lib/activerecord/cursor/params.rb', line 6 def initialize(cursor) @cursor = cursor end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
4 5 6 |
# File 'lib/activerecord/cursor/params.rb', line 4 def cursor @cursor end |
Class Method Details
.decode(cursor) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/activerecord/cursor/params.rb', line 10 def self.decode(cursor) if cursor.nil? new nil else new YAML.safe_load( Base64.urlsafe_decode64(cursor), [Symbol, Time, ActiveSupport::TimeZone, ActiveSupport::TimeWithZone], [], true ).with_indifferent_access end rescue Psych::SyntaxError raise InvalidCursor end |
Instance Method Details
#encoded ⇒ Object
25 26 27 |
# File 'lib/activerecord/cursor/params.rb', line 25 def encoded Base64.urlsafe_encode64 cursor.to_yaml end |
#value ⇒ Object
29 30 31 |
# File 'lib/activerecord/cursor/params.rb', line 29 def value @cursor end |