Class: Restforce::DB::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/restforce/db/strategy.rb

Overview

Restforce::DB::Strategy is an abstraction for the available synchronization strategies, and provides a factory method by which to obtain a strategy by name.

Class Method Summary collapse

Class Method Details

.for(name, options = {}) ⇒ Object

Public: Get a Strategy by the requested name.

name - The Symbol or String name of the desired strategy. options - A Hash of options to pass to the strategy’s initializer.

Returns a Restforce::DB::Strategies instance.



16
17
18
19
# File 'lib/restforce/db/strategy.rb', line 16

def self.for(name, options = {})
  class_name = "Restforce::DB::Strategies::#{name.to_s.camelize}"
  class_name.constantize.new(options)
end