Module: LHS::Record::Chainable::ClassMethods

Defined in:
lib/lhs/concerns/record/chainable.rb

Instance Method Summary collapse

Instance Method Details

#all(hash = nil) ⇒ Object



18
19
20
21
22
# File 'lib/lhs/concerns/record/chainable.rb', line 18

def all(hash = nil)
  chain = Chain.new(self, Parameter.new(hash))
  chain._links.push(Option.new(all: true))
  chain
end

#expanded(options = nil) ⇒ Object



24
25
26
# File 'lib/lhs/concerns/record/chainable.rb', line 24

def expanded(options = nil)
  Chain.new(self, Option.new(expanded: options || true))
end

#handle(error_class, handler) ⇒ Object



44
45
46
# File 'lib/lhs/concerns/record/chainable.rb', line 44

def handle(error_class, handler)
  Chain.new(self, ErrorHandling.new(error_class => handler))
end

#includes(*args) ⇒ Object



48
49
50
# File 'lib/lhs/concerns/record/chainable.rb', line 48

def includes(*args)
  Chain.new(self, Include.new(Chain.unfold(args)))
end

#includes_all(*args) ⇒ Object



52
53
54
55
56
# File 'lib/lhs/concerns/record/chainable.rb', line 52

def includes_all(*args)
  chain = Chain.new(self, Include.new(Chain.unfold(args)))
  chain.include_all!(args)
  chain
end

#limit(argument = nil) ⇒ Object



40
41
42
# File 'lib/lhs/concerns/record/chainable.rb', line 40

def limit(argument = nil)
  Chain.new(self, Pagination.new(per: argument))
end

#options(hash = nil) ⇒ Object



28
29
30
# File 'lib/lhs/concerns/record/chainable.rb', line 28

def options(hash = nil)
  Chain.new(self, Option.new(hash))
end

#page(page) ⇒ Object



32
33
34
# File 'lib/lhs/concerns/record/chainable.rb', line 32

def page(page)
  Chain.new(self, Pagination.new(page: page))
end

#per(limit) ⇒ Object



36
37
38
# File 'lib/lhs/concerns/record/chainable.rb', line 36

def per(limit)
  Chain.new(self, Pagination.new(per: limit))
end

#references(*args) ⇒ Object



58
59
60
# File 'lib/lhs/concerns/record/chainable.rb', line 58

def references(*args)
  Chain.new(self, Reference.new(Chain.unfold(args)))
end

#where(hash = nil) ⇒ Object



14
15
16
# File 'lib/lhs/concerns/record/chainable.rb', line 14

def where(hash = nil)
  Chain.new(self, Parameter.new(hash))
end