Class: ActiveRecord::Refined::AST::Column

Inherits:
Node
  • Object
show all
Defined in:
lib/active_record/refined/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#as, #asc, #desc

Constructor Details

#initialize(table_name, column_name) ⇒ Column

Returns a new instance of Column.



39
40
41
42
# File 'lib/active_record/refined/ast.rb', line 39

def initialize(table_name, column_name)
  @table_name = table_name
  @column_name = column_name
end

Instance Attribute Details

#column_nameObject (readonly)

Returns the value of attribute column_name.



37
38
39
# File 'lib/active_record/refined/ast.rb', line 37

def column_name
  @column_name
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



37
38
39
# File 'lib/active_record/refined/ast.rb', line 37

def table_name
  @table_name
end

Instance Method Details

#null?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/active_record/refined/ast.rb', line 52

def null?
  Comparison.new(self, :==, nil)
end

#to_arel(_table) ⇒ Object



44
45
46
# File 'lib/active_record/refined/ast.rb', line 44

def to_arel(_table)
  Arel::Table.new(table_name)[column_name]
end