Sha256: fd2ec11913a39e019708d7c78f95129b65158e6cdb5668a1c5ff11c335f678a2

Contents?: true

Size: 470 Bytes

Versions: 5

Compression:

Stored size: 470 Bytes

Contents

module Arel
  module Nodes
    class TableAlias
      attr_reader :name, :relation, :columns
      alias :table_alias :name

      def initialize name, relation
        @name     = name
        @relation = relation
        @columns  = relation.columns.map { |column|
          column.dup.tap { |col| col.relation = self }
        }
      end

      def [] name
        name = name.to_sym
        columns.find { |column| column.name == name }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arel-2.0.4 lib/arel/nodes/table_alias.rb
arel-2.0.3 lib/arel/nodes/table_alias.rb
arel-2.0.2 lib/arel/nodes/table_alias.rb
arel-2.0.1 lib/arel/nodes/table_alias.rb
arel-2.0.0 lib/arel/nodes/table_alias.rb