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, #or, #with

Constructor Details

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

Returns a new instance of Refined_Update.



307
308
309
310
# File 'lib/lore/query_shortcuts.rb', line 307

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



312
313
314
315
316
317
318
# File 'lib/lore/query_shortcuts.rb', line 312

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