Class: JoinOptions

Inherits:
Object show all
Defined in:
lib/activeleopard/query_clauses/join_clause.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assoc_options = nil, source_table = nil) ⇒ JoinOptions

Returns a new instance of JoinOptions.



32
33
34
35
36
37
# File 'lib/activeleopard/query_clauses/join_clause.rb', line 32

def initialize(assoc_options = nil, source_table = nil)
  @clauses = []
  if assoc_options && source_table
    @clauses << JoinClause.new(assoc_options, source_table)
  end
end

Instance Attribute Details

#clausesObject (readonly)

Returns the value of attribute clauses.



30
31
32
# File 'lib/activeleopard/query_clauses/join_clause.rb', line 30

def clauses
  @clauses
end

Instance Method Details

#append(assoc_options, source_table) ⇒ Object



43
44
45
# File 'lib/activeleopard/query_clauses/join_clause.rb', line 43

def append(assoc_options, source_table)
  clauses << JoinClause.new(assoc_options, source_table)
end

#as_sqlObject



39
40
41
# File 'lib/activeleopard/query_clauses/join_clause.rb', line 39

def as_sql
  clauses.map(&:as_sql).join(" \n ")
end