class Covalence::StateStore

Public Class Methods

new(attributes = {}, *args) click to toggle source
Calls superclass method
# File lib/covalence/core/entities/state_store.rb, line 23
def initialize(attributes = {}, *args)
  super
  self.valid?
end

Public Instance Methods

backend=(backend_name) click to toggle source

TODO: prep different backend for plugins

:reek: FeatureEnvy
Calls superclass method
# File lib/covalence/core/entities/state_store.rb, line 39
def backend=(backend_name)
  super("Covalence::#{backend_name.camelize}".constantize)
end
get_config() click to toggle source
# File lib/covalence/core/entities/state_store.rb, line 43
def get_config
  backend::get_state_store(@params, @workspace_enabled)
end
name() click to toggle source
# File lib/covalence/core/entities/state_store.rb, line 28
def name
  params.fetch('name')
end
params=(params) click to toggle source

:reek: FeatureEnvy

Calls superclass method
# File lib/covalence/core/entities/state_store.rb, line 33
def params=(params)
  super(params.stringify_keys)
end

Private Instance Methods

backend_has_state_store() click to toggle source
# File lib/covalence/core/entities/state_store.rb, line 56
def backend_has_state_store
  backend_has_no_state_store = !backend.has_state_store? rescue true
  if backend_has_no_state_store
    errors.add(:base,
               "#{backend} backend module does not support state storage",
               strict: true)
  end
end
validate_params_has_name() click to toggle source
# File lib/covalence/core/entities/state_store.rb, line 48
def validate_params_has_name
  if !params.has_key?('name')
    errors.add(:base,
               "Params #{params} missing 'name' parameter for the #{backend} state store",
               strict: true)
  end
end