class Ronin::SQL::StatementList
Represents a list of SQL
{Statements Statement}.
@api public
Attributes
statements[R]
The list of statements
Public Class Methods
new(&block)
click to toggle source
Initializes a new SQL
statement list.
@yield [(statements)]
If a block is given, it will be evaluated within the statement list. If the block accepts an argument, the block will be called with the new statement list.
@yieldparam [StatementList] statements
The new statement list.
# File lib/ronin/sql/statement_list.rb, line 60 def initialize(&block) @statements = [] if block case block.arity when 0 then instance_eval(&block) else block.call(self) end end end
Public Instance Methods
<<(statement)
click to toggle source
Appends a statement.
@param [Statement] statement
The SQL statement.
@return [self]
# File lib/ronin/sql/statement_list.rb, line 79 def <<(statement) @statements << statement return self end
statement(keyword,argument=nil,&block)
click to toggle source
Appends an arbitrary statement.
@param [Symbol] keyword
Name of the statement.
@param [Object] argument
Additional argument for the statement.
@yield [(statement)]
If a block is given, it will be called.
@yieldparam [Statement] statement
If the block accepts an argument, it will be passed the new statement. Otherwise the block will be evaluated within the statement.
@return [Statement]
The newly created statement.
Calls superclass method
Ronin::SQL::Statements#statement
# File lib/ronin/sql/statement_list.rb, line 103 def statement(keyword,argument=nil,&block) new_statement = super self << new_statement return new_statement end