Class: WinewooCore::Repositories::Mongo::Queries::PictoQuery
- Inherits:
-
WinewooQuery
- Object
- WinewooQuery
- WinewooCore::Repositories::Mongo::Queries::PictoQuery
- Defined in:
- lib/winewoo_core/repositories/mongo/queries/picto_query.rb
Instance Method Summary collapse
- #by_name ⇒ Object
- #from_category(category) ⇒ Object
-
#initialize(relation = PictoElement) ⇒ PictoQuery
constructor
A new instance of PictoQuery.
Methods inherited from WinewooQuery
#method_missing, #respond_to?, #respond_to_missing?
Constructor Details
#initialize(relation = PictoElement) ⇒ PictoQuery
Returns a new instance of PictoQuery.
4 5 6 |
# File 'lib/winewoo_core/repositories/mongo/queries/picto_query.rb', line 4 def initialize(relation = PictoElement) super relation end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class WinewooCore::Repositories::Mongo::Queries::WinewooQuery
Instance Method Details
#by_name ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/winewoo_core/repositories/mongo/queries/picto_query.rb', line 17 def by_name @relation = @relation .asc(:name) block_given? ? @relation.each { |picto| yield picto } : self end |
#from_category(category) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/winewoo_core/repositories/mongo/queries/picto_query.rb', line 8 def from_category(category) @relation = @relation .where(category: category) block_given? ? @relation.each { |picto| yield picto } : self end |