Class: Lore::Refined_Update

Inherits:
Refined_Query show all
Defined in:
lib/lore/query_shortcuts.rb

Overview

class

Instance Method Summary collapse

Methods inherited from Refined_Query

#having, #method_missing, #with

Constructor Details

#initialize(accessor, statements = {}) ⇒ Refined_Update

Returns a new instance of Refined_Update.



275
276
277
278
# File 'lib/lore/query_shortcuts.rb', line 275

def initialize(accessor, statements={})
  @update_values = statements[:update_values]
  super(accessor, statements)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lore::Refined_Query

Instance Method Details

#performObject



280
281
282
283
284
285
286
# File 'lib/lore/query_shortcuts.rb', line 280

def perform
  @accessor.update { |entity|
    entity.set(@update_values)
    entity.where(@condition)
    entity
  }
end