Class: RedisFixtures::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_fixtures/config.rb

Overview

Holds the configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



33
34
35
36
37
# File 'lib/redis_fixtures/config.rb', line 33

def initialize
  @connection_settings = {host: 'localhost', port: 6379}
  @fixture_filename = "redis.fixture"
  @app_root = defined?(::Rails) ? ::Rails.root : Dir.pwd
end

Instance Attribute Details

#app_rootObject

Root directory of the app (where the test or spec directory exists) Defaults to Rails.root or ‘pwd`, use only if using this gem in a non-Rails environment



9
10
11
# File 'lib/redis_fixtures/config.rb', line 9

def app_root
  @app_root
end

#connectionObject

Already established connection to Redis for the library to use One of :connection_pool, :connection_block, :connection_settings or :connection must be set



31
32
33
# File 'lib/redis_fixtures/config.rb', line 31

def connection
  @connection
end

#connection_poolObject

Connection Pool used to get a new Redis connection One of :connection_pool, :connection_block, :connection_settings or :connection must be set



18
19
20
# File 'lib/redis_fixtures/config.rb', line 18

def connection_pool
  @connection_pool
end

#connection_procObject

Proc that yields a connection object when needed One of :connection_pool, :connection_block, :connection_settings or :connection must be set



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

def connection_proc
  @connection_proc
end

#connection_settingsObject

Hash specifying the settings to connect to Redis. Gets passed to ‘Redis.new` One of :connection_pool, :connection_block, :connection_settings or :connection must be set Defaults to localhost:6379



27
28
29
# File 'lib/redis_fixtures/config.rb', line 27

def connection_settings
  @connection_settings
end

#fixture_filenameObject

Filename where to store the Redis fixtures. (Will be stored in regular fixtures path) Defaults to ‘redis.fixture’ Do not set a .yml extension, or it may get cleared out by other tools



14
15
16
# File 'lib/redis_fixtures/config.rb', line 14

def fixture_filename
  @fixture_filename
end