Class: Ronin::Code::SQL::StatementList
- Inherits:
-
Object
- Object
- Ronin::Code::SQL::StatementList
- Includes:
- Emittable, Fields, Functions, Statements
- Defined in:
- lib/ronin/code/sql/statement_list.rb
Overview
Represents a list of SQL Statement.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#statements ⇒ Object
readonly
The list of statements.
Instance Method Summary collapse
-
#<<(statement) ⇒ self
Appends a statement.
-
#initialize {|(statements)| ... } ⇒ StatementList
constructor
Initializes a new SQL statement list.
-
#statement(keyword, argument = nil) {|(statement)| ... } ⇒ Statement
Appends an arbitrary statement.
Methods included from Emittable
#emitter, #inspect, #to_s, #to_sql
Methods included from Statements
#delete, #drop_table, #insert, #select, #update
Methods included from Functions
#abs, #acos, #ascii, #asin, #atan, #atan2, #avg, #bin, #bit_and, #bit_count, #bit_length, #bit_or, #ceil, #ceiling, #char, #char_length, #character_length, #concat, #concat_ws, #conv, #cos, #cot, #count, #degrees, #elt, #exp, #export_set, #field, #find_in_set, #floor, #format, #glob, #greatest, #hex, #insert, #instr, #interval, #lcase, #least, #left, #length, #like, #load_file, #locate, #log, #log10, #lower, #lpad, #ltrim, #make_set, #max, #mid, #min, #mod, #oct, #octet_length, #ord, #pi, #position, #pow, #power, #quote, #radians, #rand, #random, #repeat, #replace, #reverse, #right, #round, #rpad, #rtrim, #sign, #sin, #sleep, #soundex, #space, #sqrt, #std, #stddev, #strcmp, #substring, #substring_index, #sum, #tan, #trim, #truncate, #ucase, #unhex, #upper
Methods included from Fields
#method_missing, #respond_to_missing?, #to_ary
Constructor Details
#initialize {|(statements)| ... } ⇒ StatementList
Initializes a new SQL statement list.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ronin/code/sql/statement_list.rb', line 59 def initialize(&block) @statements = [] if block case block.arity when 0 then instance_eval(&block) else block.call(self) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ronin::Code::SQL::Fields
Instance Attribute Details
#statements ⇒ Object (readonly)
The list of statements
46 47 48 |
# File 'lib/ronin/code/sql/statement_list.rb', line 46 def statements @statements end |
Instance Method Details
#<<(statement) ⇒ self
Appends a statement.
78 79 80 81 |
# File 'lib/ronin/code/sql/statement_list.rb', line 78 def <<(statement) @statements << statement return self end |
#statement(keyword, argument = nil) {|(statement)| ... } ⇒ Statement
Appends an arbitrary statement.
102 103 104 105 106 107 |
# File 'lib/ronin/code/sql/statement_list.rb', line 102 def statement(keyword,argument=nil,&block) new_statement = super self << new_statement return new_statement end |