Class: Graphiti::Scoping::Filter
- Includes:
- Filterable
- Defined in:
- lib/graphiti/scoping/filter.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Filterable
#dependent_filters, #filter_param, #find_filter, #find_filter!, #missing_dependent_filters, #missing_required_filters, #required_filters
Methods inherited from Base
#apply?, #apply_custom_scope, #apply_standard_scope, #initialize
Constructor Details
This class inherits a constructor from Graphiti::Scoping::Base
Instance Method Details
#apply ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/graphiti/scoping/filter.rb', line 5 def apply unless @opts[:bypass_required_filters] Graphiti::Scoping::FilterGroupValidator.new( resource, query_hash ).raise_unless_filter_group_requirements_met! end if missing_required_filters.any? && !@opts[:bypass_required_filters] raise Errors::RequiredFilter.new(resource, missing_required_filters) end if missing_dependent_filters.any? raise Errors::MissingDependentFilter.new \ resource, missing_dependent_filters end each_filter do |filter, operator, value| @scope = filter_scope(filter, operator, value) end resource.after_filtering(@scope) end |