Class: Mohair::Where

Inherits:
Object
  • Object
show all
Defined in:
lib/mohair/sql/tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(tree) ⇒ Where

Returns a new instance of Where.



167
168
169
170
171
172
173
# File 'lib/mohair/sql/tree.rb', line 167

def initialize tree
  if tree then
    @cond = Condition.new tree
  else
    @cond = nil
  end
end

Instance Method Details

#to_jsObject



174
175
176
177
178
179
180
181
# File 'lib/mohair/sql/tree.rb', line 174

def to_js
  if @cond.nil? then
    "return [ret];"
  else
    s = @cond.to_js
    "if(#{s}){ return [ret]; }else{ return[]; }"
  end
end