Class: ForestLiana::ResourcesGetter
- Inherits:
-
Object
- Object
- ForestLiana::ResourcesGetter
- Defined in:
- app/services/forest_liana/resources_getter.rb
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(resource, params) ⇒ ResourcesGetter
constructor
A new instance of ResourcesGetter.
- #perform ⇒ Object
- #records ⇒ Object
Constructor Details
#initialize(resource, params) ⇒ ResourcesGetter
Returns a new instance of ResourcesGetter.
3 4 5 6 |
# File 'app/services/forest_liana/resources_getter.rb', line 3 def initialize(resource, params) @resource = resource @params = params end |
Instance Method Details
#count ⇒ Object
19 20 21 |
# File 'app/services/forest_liana/resources_getter.rb', line 19 def count @records.to_a.count end |
#perform ⇒ Object
8 9 10 11 12 13 |
# File 'app/services/forest_liana/resources_getter.rb', line 8 def perform @records = search_query @records = sort_query @records end |
#records ⇒ Object
15 16 17 |
# File 'app/services/forest_liana/resources_getter.rb', line 15 def records @records.offset(offset).limit(limit).to_a end |