class Philtre::PlaceHolder

Attributes

bt[R]
name[R]
sql_field[R]

Public Class Methods

new( name, sql_field = nil, bt = caller ) click to toggle source

name is what gets replaced by the operation and correspondingly named value in the filter sql_field is the name of the field that the operation will compare the named value to.

# File lib/philtre/place_holder.rb, line 5
def initialize( name, sql_field = nil, bt = caller )
  # backtrace
  @bt = bt

  @name = name
  @sql_field = sql_field
end

Public Instance Methods

inspect() click to toggle source
# File lib/philtre/place_holder.rb, line 33
def inspect
  "#<#{self.class} #{name}:#{sql_field} @#{source}>"
end
small_source() click to toggle source
# File lib/philtre/place_holder.rb, line 29
def small_source
  source.split('/').last(2).join('/').split(':')[0..1].join(':')
end
source() click to toggle source
# File lib/philtre/place_holder.rb, line 25
def source
  bt[1]
end
to_s() click to toggle source
# File lib/philtre/place_holder.rb, line 37
def to_s
  "#{name}:#{sql_field} @#{small_source}"
end
to_s_append( ds, s ) click to toggle source

this is inserted into the generated SQL from a dataset that contains PlaceHolder instances.

# File lib/philtre/place_holder.rb, line 19
def to_s_append( ds, s )
  s << '$' << name.to_s
  s << ':' << sql_field.to_s if sql_field
  s << '/*' << small_source  << '*/'
end