Class: Window

Inherits:
Expression show all
Defined in:
lib/eno.rb

Instance Attribute Summary

Attributes inherited from Expression

#members, #props

Instance Method Summary collapse

Methods inherited from Expression

#!=, #!@, #%, #&, #*, #+, #-, #/, #<, #<=, #==, #>, #>=, #as, #desc, #inner_join, #join, #not_null?, #null?, #over, quote, #|

Constructor Details

#initialize(sym, &block) ⇒ Window

Returns a new instance of Window.



344
345
346
347
# File 'lib/eno.rb', line 344

def initialize(sym, &block)
  super(sym)
  @block = block
end

Instance Method Details

#to_sqlObject



349
350
351
352
353
354
# File 'lib/eno.rb', line 349

def to_sql
  "window %s as %s" % [
    Expression.quote(@members.first),
    WindowExpression.new(&@block).to_sql
  ]
end