Class: Cursed::Adapter::Sequel

Inherits:
Base
  • Object
show all
Defined in:
lib/cursed/adapter/sequel.rb

Instance Attribute Summary

Attributes inherited from Base

#relation

Instance Method Summary collapse

Methods inherited from Base

#apply_to, #initialize

Constructor Details

This class inherits a constructor from Cursed::Adapter::Base

Instance Method Details

#after(attribute, value) ⇒ Object



18
19
20
# File 'lib/cursed/adapter/sequel.rb', line 18

def after(attribute, value)
  @relation = relation.where(::Sequel.expr(attribute) > value)
end

#ascend_by(attribute) ⇒ Object



10
11
12
# File 'lib/cursed/adapter/sequel.rb', line 10

def ascend_by(attribute)
  @relation = relation.order(attribute)
end

#before(attribute, value) ⇒ Object



22
23
24
# File 'lib/cursed/adapter/sequel.rb', line 22

def before(attribute, value)
  @relation = relation.where(::Sequel.expr(attribute) < value)
end

#descend_by(attribute) ⇒ Object



6
7
8
# File 'lib/cursed/adapter/sequel.rb', line 6

def descend_by(attribute)
  @relation = relation.order(attribute).reverse
end

#limit(count) ⇒ Object



14
15
16
# File 'lib/cursed/adapter/sequel.rb', line 14

def limit(count)
  @relation = relation.limit(count)
end