Module: Arel::Relation
- Defined in:
- lib/tramp/arel_monkey_patches.rb
Instance Method Summary collapse
- #all(&block) ⇒ Object
- #call(&block) ⇒ Object
- #delete(&block) ⇒ Object
- #each(&block) ⇒ Object
- #first(&block) ⇒ Object
- #insert(record, &block) ⇒ Object
- #update(assignments, &block) ⇒ Object
Instance Method Details
#all(&block) ⇒ Object
25 26 27 |
# File 'lib/tramp/arel_monkey_patches.rb', line 25 def all(&block) session.read(self) {|rows| block.call(rows) } end |
#call(&block) ⇒ Object
21 22 23 |
# File 'lib/tramp/arel_monkey_patches.rb', line 21 def call(&block) engine.read(self, &block) end |
#delete(&block) ⇒ Object
45 46 47 |
# File 'lib/tramp/arel_monkey_patches.rb', line 45 def delete(&block) session.delete(Arel::Deletion.new(self), &block) end |
#each(&block) ⇒ Object
33 34 35 |
# File 'lib/tramp/arel_monkey_patches.rb', line 33 def each(&block) session.read(self) {|rows| rows.each {|r| block.call(r) } } end |
#first(&block) ⇒ Object
29 30 31 |
# File 'lib/tramp/arel_monkey_patches.rb', line 29 def first(&block) session.read(self) {|rows| block.call(rows[0]) } end |
#insert(record, &block) ⇒ Object
37 38 39 |
# File 'lib/tramp/arel_monkey_patches.rb', line 37 def insert(record, &block) session.create(Arel::Insert.new(self, record), &block) end |
#update(assignments, &block) ⇒ Object
41 42 43 |
# File 'lib/tramp/arel_monkey_patches.rb', line 41 def update(assignments, &block) session.update(Arel::Update.new(self, assignments), &block) end |