Class: ParamsReady::Query::StructuredGroupingDefinition

Inherits:
Parameter::StructParameterDefinition show all
Defined in:
lib/params_ready/query/structured_grouping.rb

Instance Attribute Summary collapse

Attributes inherited from Parameter::AbstractStructParameterDefinition

#key_map, #names

Attributes inherited from Parameter::Definition

#default

Attributes inherited from Parameter::AbstractDefinition

#altn, #name

Instance Method Summary collapse

Methods inherited from Parameter::StructParameterDefinition

#add_map, #ensure_canonical, #remap?

Methods inherited from Parameter::AbstractStructParameterDefinition

#add_child, #child_definition, #duplicate_value, #freeze_value, #has_child?, #infer_default, #set_default

Methods inherited from Parameter::Definition

#canonical_default, #default_defined?, #fetch_callable_default, #fetch_default, #finish, #memoize?, #name_for_formatter, #no_input?, #no_output?, #postprocess, #preprocess, #restricted_for_format?, #set_local, #set_no_input, #set_postprocessor, #set_preprocessor

Methods inherited from Parameter::AbstractDefinition

#create, #finish, #from_hash, #from_input, #normalize_alternative_name, #parameter_class

Methods included from Extensions::Freezer

#freeze_variable, #freeze_variables, #variables_to_freeze

Methods included from Extensions::Finalizer

#obligatory, #obligatory!

Methods included from Extensions::ClassReaderWriter

#class_reader_writer

Methods included from Extensions::LateInit

#late_init

Methods included from Extensions::Collection

#collection

Methods included from Extensions::Finalizer::InstanceMethods

#finish

Methods included from Extensions::Freezer::InstanceMethods

#freeze

Constructor Details

#initialize(*args, **opts) ⇒ StructuredGroupingDefinition

Returns a new instance of StructuredGroupingDefinition.



43
44
45
46
# File 'lib/params_ready/query/structured_grouping.rb', line 43

def initialize(*args, **opts)
  @predicates = {}
  super *args, **opts
end

Instance Attribute Details

#arel_tableObject (readonly)

Returns the value of attribute arel_table.



41
42
43
# File 'lib/params_ready/query/structured_grouping.rb', line 41

def arel_table
  @arel_table
end

#predicatesObject (readonly)

Returns the value of attribute predicates.



41
42
43
# File 'lib/params_ready/query/structured_grouping.rb', line 41

def predicates
  @predicates
end

Instance Method Details

#add_predicate(predicate) ⇒ Object

Raises:



48
49
50
51
# File 'lib/params_ready/query/structured_grouping.rb', line 48

def add_predicate(predicate)
  raise ParamsReadyError, "Predicate name taken: '#{predicate.name}" if predicates.key? predicate.name
  predicates[predicate.name] = predicate
end