Class: ParamsReady::Query::ArrayGrouping

Inherits:
Parameter::StructParameter show all
Includes:
Parameter::GroupingLike
Defined in:
lib/params_ready/query/array_grouping.rb

Constant Summary

Constants inherited from Parameter::AbstractStructParameter

Parameter::AbstractStructParameter::EMPTY_HASH

Instance Attribute Summary

Attributes inherited from Parameter::AbstractParameter

#definition

Instance Method Summary collapse

Methods included from Parameter::GroupingLike

#eligible_for_query?, #predicate_group, #test, #to_query_if_eligible

Methods included from Marshaller::ParameterModule

#marshal

Methods inherited from Parameter::AbstractStructParameter

#[], #[]=, #find_in_hash, #for_frontend, #for_model, #for_output, #wrap_output

Methods included from Parameter::ComplexParameter

#update_child

Methods inherited from Parameter::Parameter

#allows_undefined?, #definite_default?, #eligible_for_output?, #find_in_hash, #format, #format_self_permitted, #freeze, #hash, #hash_key, #initialize, #inspect_content, #is_default?, #is_definite?, #is_nil?, #is_undefined?, #memo, #memo!, #nil_default?, #populate_other, #set_from_input, #set_value, #to_hash_if_eligible, #unwrap, #unwrap_or, #wrap_output

Methods inherited from Parameter::AbstractParameter

#==, #dup, #initialize, #inspect, intent_for_children, #match?, #populate, #to_hash, #update_if_applicable, #update_in

Methods included from Extensions::Freezer

#freeze_variable, #freeze_variables, #variables_to_freeze

Methods included from Parameter::FromHash

#set_from_hash

Methods included from Extensions::Freezer::InstanceMethods

#freeze

Constructor Details

This class inherits a constructor from ParamsReady::Parameter::Parameter

Instance Method Details

#context_for_predicates(restriction) ⇒ Object



19
20
21
# File 'lib/params_ready/query/array_grouping.rb', line 19

def context_for_predicates(restriction)
  restriction.for_children(self)
end

#operatorObject



15
16
17
# File 'lib/params_ready/query/array_grouping.rb', line 15

def operator
  self[:operator].unwrap
end

#predicatesObject



11
12
13
# File 'lib/params_ready/query/array_grouping.rb', line 11

def predicates
  self[:array].to_a
end

#to_query(arel_table, context: Restriction.blanket_permission) ⇒ Object



23
24
25
26
27
28
# File 'lib/params_ready/query/array_grouping.rb', line 23

def to_query(arel_table, context: Restriction.blanket_permission)
  array = self[:array]

  context = array.intent_for_children(context)
  super arel_table, context: context
end