Class: Mince::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mince/config.rb

Overview

Configuration for Mince

Mince can be configured to interact with different mince supported data interfaces.

Simply run the following to specify the data interface to use Mince::Config.interface = Mince::MyDb::Interface

This is a singleton object in order to prevent multiple instances of this object from being used.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#interfaceObject

Returns the value of attribute interface.



16
17
18
# File 'lib/mince/config.rb', line 16

def interface
  @interface
end

Class Method Details

.interfaceObject

Returns the interface that is configured to be used. Use this method instead of hard coding which mince interface to use throughout your code so that you can change mince interfaces as needed.



29
30
31
# File 'lib/mince/config.rb', line 29

def self.interface
  instance.interface
end

.interface=(interface) ⇒ Object

Sets the singleton's interface attribute so that you can change your storage strategy without changing all references to that class.



22
23
24
# File 'lib/mince/config.rb', line 22

def self.interface=(interface)
  instance.interface = interface
end