Class: Prequel::Expressions::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/prequel/expressions/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, name, type) ⇒ Column

Returns a new instance of Column.



6
7
8
# File 'lib/prequel/expressions/column.rb', line 6

def initialize(table, name, type)
  @table, @name, @type = table, name, type
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/prequel/expressions/column.rb', line 4

def name
  @name
end

#tableObject (readonly)

Returns the value of attribute table.



4
5
6
# File 'lib/prequel/expressions/column.rb', line 4

def table
  @table
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/prequel/expressions/column.rb', line 4

def type
  @type
end

Instance Method Details

#alias_nameObject



10
11
12
# File 'lib/prequel/expressions/column.rb', line 10

def alias_name
  nil
end

#eq(other) ⇒ Object



14
15
16
# File 'lib/prequel/expressions/column.rb', line 14

def eq(other)
  Equal.new(self, other)
end

#expressionObject



22
23
24
# File 'lib/prequel/expressions/column.rb', line 22

def expression
  self
end

#originObject



26
27
28
# File 'lib/prequel/expressions/column.rb', line 26

def origin
  self
end

#qualified_nameObject



18
19
20
# File 'lib/prequel/expressions/column.rb', line 18

def qualified_name
  "#{table.name}__#{name}".to_sym
end

#resolve_in_query(query) ⇒ Object



30
31
32
# File 'lib/prequel/expressions/column.rb', line 30

def resolve_in_query(query)
  query.singular_table_refs[table].resolve_column(self)
end