Module: ActionSet::InstanceMethods
- Defined in:
- lib/action_set.rb
Instance Method Summary collapse
- #export_set(set) ⇒ Object
- #filter_set(set) ⇒ Object
-
#paginate_set(set) ⇒ Object
TODO: should we move the default value setting to this layer, and have ActiveSet require instructions for pagination?.
- #process_set(set) ⇒ Object
- #sort_set(set) ⇒ Object
Instance Method Details
#export_set(set) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/action_set.rb', line 46 def export_set(set) return send_file(set, (request.format)) if set.is_a?(String) && File.file?(set) active_set = ensure_active_set(set) exported_data = active_set.export(export_instructions) send_data(exported_data, (request.format)) end |
#filter_set(set) ⇒ Object
26 27 28 29 30 |
# File 'lib/action_set.rb', line 26 def filter_set(set) active_set = ensure_active_set(set) active_set = active_set.filter(FilterInstructions.new(filter_params, set, self).get) if filter_params.any? active_set end |
#paginate_set(set) ⇒ Object
TODO: should we move the default value setting to this layer, and have ActiveSet require instructions for pagination?
40 41 42 43 44 |
# File 'lib/action_set.rb', line 40 def paginate_set(set) active_set = ensure_active_set(set) active_set = active_set.paginate(paginate_instructions) active_set end |
#process_set(set) ⇒ Object
22 23 24 |
# File 'lib/action_set.rb', line 22 def process_set(set) paginate_set(sort_set(filter_set(ensure_active_set(set)))) end |
#sort_set(set) ⇒ Object
32 33 34 35 36 |
# File 'lib/action_set.rb', line 32 def sort_set(set) active_set = ensure_active_set(set) active_set = active_set.sort(SortInstructions.new(sort_params, set, self).get) if sort_params.any? active_set end |