Module: AppQuery::Mappable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/app_query/mappable.rb
Overview
Note:
Middleware concern that maps query results to Ruby objects in BaseQuery subclasses.
Include this module to automatically convert result hashes into typed objects like +Data+ classes or +Struct+s.
By default, looks for an +Item+ constant in the query class. Use +map_to+ to specify a different class.
Instance Method Summary collapse
Instance Method Details
#raw ⇒ Object
64 65 66 67 |
# File 'lib/app_query/mappable.rb', line 64 def raw @raw = true self end |
#select_all ⇒ Object
69 70 71 |
# File 'lib/app_query/mappable.rb', line 69 def select_all map_result(super) end |
#select_one ⇒ Object
73 74 75 |
# File 'lib/app_query/mappable.rb', line 73 def select_one map_one(super) end |