Module: Care::AutoFinder::Findable::ClassMethods
- Defined in:
- lib/care/auto_finder/findable.rb
Instance Attribute Summary collapse
-
#chain_filter ⇒ Object
Returns the value of attribute chain_filter.
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
- #entity ⇒ Object
- #filter_by(*filters) ⇒ Object
- #relation ⇒ Object
-
#set_relation(relation) ⇒ Object
attr_accessor :relation.
Instance Attribute Details
#chain_filter ⇒ Object
Returns the value of attribute chain_filter.
8 9 10 |
# File 'lib/care/auto_finder/findable.rb', line 8 def chain_filter @chain_filter end |
Instance Method Details
#call(options = {}) ⇒ Object
39 40 41 |
# File 'lib/care/auto_finder/findable.rb', line 39 def call( = {}) new().call end |
#entity ⇒ Object
15 16 17 |
# File 'lib/care/auto_finder/findable.rb', line 15 def entity self.relation = yield end |
#filter_by(*filters) ⇒ Object
19 20 21 |
# File 'lib/care/auto_finder/findable.rb', line 19 def filter_by(*filters) self.chain_filter = filters end |
#relation ⇒ Object
23 24 25 |
# File 'lib/care/auto_finder/findable.rb', line 23 def relation @relation ||= /(.*)Finder/.match(name)[1].singularize.constantize end |
#set_relation(relation) ⇒ Object
attr_accessor :relation
11 12 13 |
# File 'lib/care/auto_finder/findable.rb', line 11 def set_relation(relation) @relation = relation end |