Class: Arel::Table
  
  
  
  Class Attribute Summary collapse
  
  Instance Attribute Summary collapse
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #coalesce, #create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
  
  
  
  
  
  
  
  
  Methods included from Crud
  #compile_delete, #compile_insert, #compile_update, #create_insert
  Constructor Details
  
    
  
  
    #initialize(name, as: nil, type_caster: nil)  ⇒ Table 
  
  
  
  
    
Returns a new instance of Table.
   
 
  
  
    
      
16
17
18
19
20
21
22
23
24
25
26
27 
     | 
    
      # File 'lib/arel/table.rb', line 16
def initialize(name, as: nil, type_caster: nil)
  @name = name.to_s
  @type_caster = type_caster
        if as.to_s == @name
    as = nil
  end
  @table_alias = as
end
     | 
  
 
  
 
  
    Class Attribute Details
    
      
      
      
  
  
    .engine  ⇒ Object 
  
  
  
  
    
Returns the value of attribute engine.
   
 
  
  
    
      
9
10
11 
     | 
    
      # File 'lib/arel/table.rb', line 9
def engine
  @engine
end 
     | 
  
 
    
   
  
    Instance Attribute Details
    
      
      
      
  
  
    #name  ⇒ Object 
  
  
    Also known as:
    table_name
    
  
  
  
    
Returns the value of attribute name.
   
 
  
  
    
      
11
12
13 
     | 
    
      # File 'lib/arel/table.rb', line 11
def name
  @name
end 
     | 
  
 
    
      
      
      
  
  
    #table_alias  ⇒ Object 
  
  
  
  
    
Returns the value of attribute table_alias.
   
 
  
  
    
      
11
12
13 
     | 
    
      # File 'lib/arel/table.rb', line 11
def table_alias
  @table_alias
end 
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    #[](name)  ⇒ Object 
  
  
  
  
    
      
81
82
83 
     | 
    
      # File 'lib/arel/table.rb', line 81
def [](name)
  ::Arel::Attribute.new self, name
end 
     | 
  
 
    
      
  
  
    #able_to_type_cast?  ⇒ Boolean 
  
  
  
  
    
      
103
104
105 
     | 
    
      # File 'lib/arel/table.rb', line 103
def able_to_type_cast?
  !type_caster.nil?
end 
     | 
  
 
    
      
  
  
    #alias(name = "#{self.name}_2")  ⇒ Object 
  
  
  
  
    
      
29
30
31 
     | 
    
      # File 'lib/arel/table.rb', line 29
def alias(name = "#{self.name}_2")
  Nodes::TableAlias.new(self, name)
end
     | 
  
 
    
      
  
  
    #eql?(other)  ⇒ Boolean 
  
  
    Also known as:
    ==
    
  
  
  
    
      
92
93
94
95
96 
     | 
    
      # File 'lib/arel/table.rb', line 92
def eql?(other)
  self.class == other.class &&
    self.name == other.name &&
    self.table_alias == other.table_alias
end
     | 
  
 
    
      
  
  
    #from  ⇒ Object 
  
  
  
  
    
      
33
34
35 
     | 
    
      # File 'lib/arel/table.rb', line 33
def from
  SelectManager.new(self)
end 
     | 
  
 
    
      
  
  
    #group(*columns)  ⇒ Object 
  
  
  
  
    
      
53
54
55 
     | 
    
      # File 'lib/arel/table.rb', line 53
def group(*columns)
  from.group(*columns)
end 
     | 
  
 
    
      
  
  
    #hash  ⇒ Object 
  
  
  
  
    
      
85
86
87
88
89
90 
     | 
    
      # File 'lib/arel/table.rb', line 85
def hash
        @name.hash
end
     | 
  
 
    
      
  
  
    #having(expr)  ⇒ Object 
  
  
  
  
    
      
77
78
79 
     | 
    
      # File 'lib/arel/table.rb', line 77
def having(expr)
  from.having expr
end 
     | 
  
 
    
      
  
  
    #join(relation, klass = Nodes::InnerJoin)  ⇒ Object 
  
  
  
 
    
      
  
  
    #order(*expr)  ⇒ Object 
  
  
  
  
    
      
57
58
59 
     | 
    
      # File 'lib/arel/table.rb', line 57
def order(*expr)
  from.order(*expr)
end 
     | 
  
 
    
      
  
  
    #outer_join(relation)  ⇒ Object 
  
  
  
  
    
      
49
50
51 
     | 
    
      # File 'lib/arel/table.rb', line 49
def outer_join(relation)
  join(relation, Nodes::OuterJoin)
end 
     | 
  
 
    
      
  
  
    #project(*things)  ⇒ Object 
  
  
  
  
    
      
65
66
67 
     | 
    
      # File 'lib/arel/table.rb', line 65
def project(*things)
  from.project(*things)
end 
     | 
  
 
    
      
  
  
    #skip(amount)  ⇒ Object 
  
  
  
  
    
      
73
74
75 
     | 
    
      # File 'lib/arel/table.rb', line 73
def skip(amount)
  from.skip amount
end 
     | 
  
 
    
      
  
  
    #take(amount)  ⇒ Object 
  
  
  
  
    
      
69
70
71 
     | 
    
      # File 'lib/arel/table.rb', line 69
def take(amount)
  from.take amount
end 
     | 
  
 
    
      
  
  
    #type_cast_for_database(attribute_name, value)  ⇒ Object 
  
  
  
  
    
      
99
100
101 
     | 
    
      # File 'lib/arel/table.rb', line 99
def type_cast_for_database(attribute_name, value)
  type_caster.type_cast_for_database(attribute_name, value)
end 
     | 
  
 
    
      
  
  
    #where(condition)  ⇒ Object 
  
  
  
  
    
      
61
62
63 
     | 
    
      # File 'lib/arel/table.rb', line 61
def where(condition)
  from.where condition
end 
     |