Class: ParamsReady::Query::StructuredGrouping

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

Direct Known Subclasses

ExistsPredicate, Relation

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, #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



25
26
27
# File 'lib/params_ready/query/structured_grouping.rb', line 25

def context_for_predicates(restriction)
  intent_for_children(restriction)
end

#operatorObject



21
22
23
# File 'lib/params_ready/query/structured_grouping.rb', line 21

def operator
  self[:operator].unwrap
end

#predicatesObject



11
12
13
14
15
16
17
18
19
# File 'lib/params_ready/query/structured_grouping.rb', line 11

def predicates
  return [] if is_nil?

  definition.predicates.keys.map do |name|
    parameter = child(name)
    next nil unless parameter.is_definite?
    parameter
  end.compact
end