Module: LHS::Record::Chainable::ClassMethods
- Defined in:
- lib/lhs/concerns/record/chainable.rb
Instance Method Summary collapse
- #all(hash = nil) ⇒ Object
- #expanded(options = nil) ⇒ Object
- #fetch ⇒ Object
- #handle(error_class, handler) ⇒ Object
- #ignore(*error_classes) ⇒ Object
- #includes(*args) ⇒ Object
- #includes_all(*args) ⇒ Object
- #limit(argument = nil) ⇒ Object
- #options(hash = nil) ⇒ Object
- #page(page) ⇒ Object
- #per(limit) ⇒ Object
- #references(*args) ⇒ Object
- #where(hash = nil) ⇒ Object
Instance Method Details
#all(hash = nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/lhs/concerns/record/chainable.rb', line 23 def all(hash = nil) chain = Chain.new(self, Parameter.new(hash)) chain._links.push(Option.new(all: true)) chain end |
#expanded(options = nil) ⇒ Object
29 30 31 |
# File 'lib/lhs/concerns/record/chainable.rb', line 29 def ( = nil) Chain.new(self, Option.new(expanded: || true)) end |
#fetch ⇒ Object
19 20 21 |
# File 'lib/lhs/concerns/record/chainable.rb', line 19 def fetch Chain.new(self, nil).fetch end |
#handle(error_class, handler) ⇒ Object
49 50 51 |
# File 'lib/lhs/concerns/record/chainable.rb', line 49 def handle(error_class, handler) Chain.new(self, ErrorHandling.new(error_class => handler)) end |
#ignore(*error_classes) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/lhs/concerns/record/chainable.rb', line 53 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) ⇒ Object
61 62 63 |
# File 'lib/lhs/concerns/record/chainable.rb', line 61 def includes(*args) Chain.new(self, Include.new(Chain.unfold(args))) end |
#includes_all(*args) ⇒ Object
65 66 67 68 69 |
# File 'lib/lhs/concerns/record/chainable.rb', line 65 def includes_all(*args) chain = Chain.new(self, Include.new(Chain.unfold(args))) chain.include_all!(args) chain end |
#limit(argument = nil) ⇒ Object
45 46 47 |
# File 'lib/lhs/concerns/record/chainable.rb', line 45 def limit(argument = nil) Chain.new(self, Pagination.new(per: argument)) end |
#options(hash = nil) ⇒ Object
33 34 35 |
# File 'lib/lhs/concerns/record/chainable.rb', line 33 def (hash = nil) Chain.new(self, Option.new(hash)) end |
#page(page) ⇒ Object
37 38 39 |
# File 'lib/lhs/concerns/record/chainable.rb', line 37 def page(page) Chain.new(self, Pagination.new(page: page)) end |
#per(limit) ⇒ Object
41 42 43 |
# File 'lib/lhs/concerns/record/chainable.rb', line 41 def per(limit) Chain.new(self, Pagination.new(per: limit)) end |