Class: Cursed::Adapter::Base
- Inherits:
-
Object
- Object
- Cursed::Adapter::Base
- Defined in:
- lib/cursed/adapter/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
- #apply_to(cursor) ⇒ Object
-
#initialize(array) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(array) ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/cursed/adapter/base.rb', line 8 def initialize(array) @relation = array end |
Instance Attribute Details
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
6 7 8 |
# File 'lib/cursed/adapter/base.rb', line 6 def relation @relation end |
Instance Method Details
#apply_to(cursor) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cursed/adapter/base.rb', line 12 def apply_to(cursor) attr = cursor.attribute after(attr, cursor.after) if cursor.after? before(attr, cursor.before) if cursor.before? if cursor.forward? ascend_by(attr) else descend_by(attr) end limit(cursor.clamped_limit) relation end |