Sha256: 269b3b19d80d1b71f892d5ae24fd37dc5583026b0a7b8fb6e738675c2d9a8bb2
Contents?: true
Size: 819 Bytes
Versions: 1
Compression:
Stored size: 819 Bytes
Contents
module SQLTree::Node class Source < Base attr_accessor :table_reference, :joins def initialize(table_reference, joins = []) @table_reference, @joins = table_reference, joins end def table table_reference.table end def table_alias table_reference.table_alias end def to_sql sql = table_reference.to_sql sql << ' ' << joins.map { |j| j.to_sql }.join(' ') if joins.any? return sql end def ==(other) other.table_reference = self.table_reference && other.joins == self.joins end def self.parse(tokens) source = self.new(SQLTree::Node::TableReference.parse(tokens)) while tokens.peek && tokens.peek.join? source.joins << Join.parse(tokens) end return source end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sql_tree-0.0.1 | lib/sql_tree/node/source.rb |