module LHS::Record::Chainable::ClassMethods

Public Instance Methods

all(hash = nil) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 29
def all(hash = nil)
  chain = Chain.new(self, Parameter.new(hash))
  chain._links.push(Option.new(all: true))
  chain
end
expanded(options = nil) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 35
def expanded(options = nil)
  Chain.new(self, Option.new(expanded: options || true))
end
fetch() click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 25
def fetch
  Chain.new(self, nil).fetch
end
ignore(*error_classes) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 59
def ignore(*error_classes)
  chain = Chain.new(self, IgnoredError.new(error_classes.shift))
  error_classes.each do |error_class|
    chain._links.push(IgnoredError.new(error_class))
  end
  chain
end
includes(*args) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 71
def includes(*args)
  chain = Chain.new(self, Include.new(Chain.unfold(args)))
  chain.include_all!(args)
  chain
end
includes_first_page(*args) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 67
def includes_first_page(*args)
  Chain.new(self, Include.new(Chain.unfold(args)))
end
limit(argument = nil) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 51
def limit(argument = nil)
  Chain.new(self, Pagination.new(per: argument))
end
options(hash = nil) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 39
def options(hash = nil)
  Chain.new(self, Option.new(hash))
end
page(page) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 43
def page(page)
  Chain.new(self, Pagination.new(page: page))
end
per(limit) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 47
def per(limit)
  Chain.new(self, Pagination.new(per: limit))
end
references(*args) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 77
def references(*args)
  Chain.new(self, Reference.new(Chain.unfold(args)))
end
rescue(error_class, handler) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 55
def rescue(error_class, handler)
  Chain.new(self, ErrorHandling.new(error_class => handler))
end
where(args = nil) click to toggle source
# File lib/lhs/concerns/record/chainable.rb, line 17
def where(args = nil)
  if href?(args)
    Chain.new(self, Option.new(url: args))
  else
    Chain.new(self, Parameter.new(args))
  end
end