Class: Mao::Filter::Column

Inherits:
Object
  • Object
show all
Includes:
Mao::Filter
Defined in:
lib/mao/filter.rb

Overview

A reference to a column(‘s value) in a filter.

Instance Attribute Summary

Attributes included from Mao::Filter

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mao::Filter

#!=, #<, #<=, #==, #>, #>=, #and, finalize_or_literal, #in, #initialize, #null?, #or

Class Method Details

.sql(*opts) ⇒ Object

Used by Mao::Filter.sql to generate the actual SQL for a column reference.



114
115
116
# File 'lib/mao/filter.rb', line 114

def self.sql(*opts)
  opts.map {|i| Mao.quote_ident(i.to_s)}.join(".")
end

Instance Method Details

#finalizeObject

Produces an array which becomes part of the resulting Mao::Query’s options, used by Mao::Query#sql.



104
105
106
107
108
109
110
# File 'lib/mao/filter.rb', line 104

def finalize
  if @options[:table]
    [:Column, @options[:table], @options[:name]]
  else
    [:Column, @options[:name]]
  end
end