Module: ParamsReady::Query::Predicate::DelegatingPredicate

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



146
147
148
# File 'lib/params_ready/query/predicate.rb', line 146

def data
  @data
end

Class Method Details

.included(base) ⇒ Object



130
131
132
# File 'lib/params_ready/query/predicate.rb', line 130

def self.included(base)
  base.include Parameter::DelegatingParameter
end

Instance Method Details

#eligible_for_query?(_table, context) ⇒ Boolean

Returns:

  • (Boolean)


134
135
136
137
138
# File 'lib/params_ready/query/predicate.rb', line 134

def eligible_for_query?(_table, context)
  return false unless context.permitted? self

  is_definite?
end

#to_query_if_eligible(arel_table, context:) ⇒ Object



140
141
142
143
144
145
# File 'lib/params_ready/query/predicate.rb', line 140

def to_query_if_eligible(arel_table, context:)
  return unless eligible_for_query?(arel_table, context)

  context = context_for_predicates(context)
  to_query(arel_table, context: context)
end