Class: RedisFixtures::Configuration
- Inherits:
-
Object
- Object
- RedisFixtures::Configuration
- Defined in:
- lib/redis_fixtures/config.rb
Overview
Holds the configuration
Instance Attribute Summary collapse
-
#app_root ⇒ Object
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.
-
#connection ⇒ Object
Already established connection to Redis for the library to use One of :connection_pool, :connection_block, :connection_settings or :connection must be set.
-
#connection_pool ⇒ Object
Connection Pool used to get a new Redis connection One of :connection_pool, :connection_block, :connection_settings or :connection must be set.
-
#connection_proc ⇒ Object
Proc that yields a connection object when needed One of :connection_pool, :connection_block, :connection_settings or :connection must be set.
-
#connection_settings ⇒ Object
Hash specifying the settings to connect to Redis.
-
#fixture_filename ⇒ Object
Filename where to store the Redis fixtures.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_root ⇒ Object
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 |
#connection ⇒ Object
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_pool ⇒ Object
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_proc ⇒ Object
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_settings ⇒ Object
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_filename ⇒ Object
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 |