Module: Quo::ComposedQuery::ClassMethods

Defined in:
lib/quo/composed_query.rb,
sig/generated/quo/composed_query.rbs

Overview

Class-level methods shared by every composed query class. Defined once here and extended onto each anon class via the included hook below rather than being re-defined on every Class.new in the composer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_composing_joinsObject (readonly)

Returns the value of attribute _composing_joins.

Returns:

  • (Object)


14
15
16
# File 'lib/quo/composed_query.rb', line 14

def _composing_joins
  @_composing_joins
end

#_left_queryObject (readonly)

Returns the value of attribute _left_query.

Returns:

  • (Object)


14
15
16
# File 'lib/quo/composed_query.rb', line 14

def _left_query
  @_left_query
end

#_left_specificationObject (readonly)

Returns the value of attribute _left_specification.

Returns:

  • (Object)


14
15
16
# File 'lib/quo/composed_query.rb', line 14

def _left_specification
  @_left_specification
end

#_right_queryObject (readonly)

Returns the value of attribute _right_query.

Returns:

  • (Object)


14
15
16
# File 'lib/quo/composed_query.rb', line 14

def _right_query
  @_right_query
end

#_right_specificationObject (readonly)

Returns the value of attribute _right_specification.

Returns:

  • (Object)


14
15
16
# File 'lib/quo/composed_query.rb', line 14

def _right_specification
  @_right_specification
end

Instance Method Details

#inspectString

Returns:

  • (String)


17
18
19
20
21
22
23
24
25
26
# File 'lib/quo/composed_query.rb', line 17

def inspect
  left_desc = quo_operand_desc(_left_query)
  right_desc = quo_operand_desc(_right_query)
  klass_name = if self < Quo::RelationBackedQuery
    Quo.relation_backed_query_base_class.name
  else
    Quo.collection_backed_query_base_class.name
  end
  "#{klass_name}<Quo::ComposedQuery>[#{left_desc}, #{right_desc}]"
end

#quo_operand_desc(operand) ⇒ String

Parameters:

  • operand (Class)

Returns:

  • (String)


30
31
32
33
34
35
36
# File 'lib/quo/composed_query.rb', line 30

def quo_operand_desc(operand)
  if operand < Quo::ComposedQuery
    operand.inspect
  else
    operand.name || operand.superclass&.name || "(anonymous)"
  end
end