Class: Sqlbuilder::Statements::Update
- Inherits:
-
Object
- Object
- Sqlbuilder::Statements::Update
- Includes:
- Builders::UpdateBuilder
- Defined in:
- lib/sqlbuilder/statements/update.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(utils) ⇒ Update
constructor
A new instance of Update.
- #set(set) ⇒ Object
- #table(table) ⇒ Object
- #where(filter_hash) ⇒ Object
Methods included from Builders::UpdateBuilder
Constructor Details
#initialize(utils) ⇒ Update
Returns a new instance of Update.
8 9 10 |
# File 'lib/sqlbuilder/statements/update.rb', line 8 def initialize(utils) @utils = utils end |
Instance Method Details
#build ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/sqlbuilder/statements/update.rb', line 30 def build sql = "UPDATE #{@table}" sql << " #{build_set}" sql << " #{build_where}" if @where sql end |
#set(set) ⇒ Object
18 19 20 21 22 |
# File 'lib/sqlbuilder/statements/update.rb', line 18 def set(set) @set = set self end |
#table(table) ⇒ Object
12 13 14 15 16 |
# File 'lib/sqlbuilder/statements/update.rb', line 12 def table(table) @table = table self end |
#where(filter_hash) ⇒ Object
24 25 26 27 28 |
# File 'lib/sqlbuilder/statements/update.rb', line 24 def where(filter_hash) @where = filter_hash self end |