Module: Mongoid::DynamicMatchers::Finder
- Included in:
- FindBy
- Defined in:
- lib/mongoid/dynamic_matchers.rb
Instance Method Summary collapse
Instance Method Details
#attributes_hash ⇒ Object
88 89 90 |
# File 'lib/mongoid/dynamic_matchers.rb', line 88 def attributes_hash "{" + attribute_names.map { |name| ":#{name} => #{name}" }.join(',') + "}" end |
#body ⇒ Object
76 77 78 |
# File 'lib/mongoid/dynamic_matchers.rb', line 76 def body result end |
#finder ⇒ Object
92 93 94 |
# File 'lib/mongoid/dynamic_matchers.rb', line 92 def finder raise NotImplementedError end |
#result ⇒ Object
80 81 82 |
# File 'lib/mongoid/dynamic_matchers.rb', line 80 def result "#{finder}(#{attributes_hash}).first" end |
#signature ⇒ Object
84 85 86 |
# File 'lib/mongoid/dynamic_matchers.rb', line 84 def signature attribute_names.join(', ') end |