Class: Arel::Having

Inherits:
Compound show all
Defined in:
lib/arel/algebra/relations/operations/having.rb

Instance Attribute Summary collapse

Attributes inherited from Compound

#engine, #relation

Attributes included from Relation

#count

Instance Method Summary collapse

Methods inherited from Compound

#attributes, #column_for, #externalizable?, #join?, #joins, #name, #skipped, #sources, #table, #table_alias, #table_sql, #taken, #unoperated_rows

Methods included from Relation

#[], #alias, #attributes, #bind, #call, #christener, #compiler, #delete, #each, #exclusion_predicate_sql, #externalizable?, #externalize, #find_attribute_matching_name, #from, #from_clauses, #group_clauses, #groupings, #having_clauses, #inclusion_predicate_sql, #insert, #inserts, #join, #join?, #joins, #lock, #locked, #order_clauses, #orders, #outer_join, #position_of, #primary_key, #project, #projections, #select_clauses, #session, #skip, #skipped, #sources, #take, #taken, #to_sql, #update, #where, #where_clauses, #wheres

Constructor Details

#initialize(relation, predicates) ⇒ Having

Returns a new instance of Having.



5
6
7
8
# File 'lib/arel/algebra/relations/operations/having.rb', line 5

def initialize(relation, predicates)
  super(relation)
  @predicates = predicates.map { |p| p.bind(relation) }
end

Instance Attribute Details

#predicatesObject (readonly)

Returns the value of attribute predicates.



3
4
5
# File 'lib/arel/algebra/relations/operations/having.rb', line 3

def predicates
  @predicates
end

Instance Method Details

#havingsObject



10
11
12
# File 'lib/arel/algebra/relations/operations/having.rb', line 10

def havings
  @havings ||= relation.havings + predicates
end