Class: DistributedCache::Config
- Inherits:
-
Struct
- Object
- Struct
- DistributedCache::Config
- Defined in:
- lib/distributed_cache/config.rb
Instance Attribute Summary collapse
-
#bundle_dir ⇒ Object
Returns the value of attribute bundle_dir.
-
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
-
#file_server_bundle_dir ⇒ Object
Returns the value of attribute file_server_bundle_dir.
-
#file_server_port ⇒ Object
Returns the value of attribute file_server_port.
-
#file_server_user ⇒ Object
Returns the value of attribute file_server_user.
-
#file_servers ⇒ Object
Returns the value of attribute file_servers.
-
#remote_bundle_dir ⇒ Object
Returns the value of attribute remote_bundle_dir.
Instance Method Summary collapse
- #file_server_with_port ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #next_file_server ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 |
# File 'lib/distributed_cache/config.rb', line 11 def initialize self.file_server_port = 80 self.remote_bundle_dir = 'cache/bundles' self.cache_dir = "#{Rails.root}/cache" if defined?(Rails) self.bundle_dir = "#{Rails.root}/bundles" if defined?(Rails) end |
Instance Attribute Details
#bundle_dir ⇒ Object
Returns the value of attribute bundle_dir
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def bundle_dir @bundle_dir end |
#cache_dir ⇒ Object
Returns the value of attribute cache_dir
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def cache_dir @cache_dir end |
#file_server_bundle_dir ⇒ Object
Returns the value of attribute file_server_bundle_dir
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def file_server_bundle_dir @file_server_bundle_dir end |
#file_server_port ⇒ Object
Returns the value of attribute file_server_port
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def file_server_port @file_server_port end |
#file_server_user ⇒ Object
Returns the value of attribute file_server_user
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def file_server_user @file_server_user end |
#file_servers ⇒ Object
Returns the value of attribute file_servers
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def file_servers @file_servers end |
#remote_bundle_dir ⇒ Object
Returns the value of attribute remote_bundle_dir
2 3 4 |
# File 'lib/distributed_cache/config.rb', line 2 def remote_bundle_dir @remote_bundle_dir end |
Instance Method Details
#file_server_with_port ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/distributed_cache/config.rb', line 25 def file_server_with_port if self.file_server_port == 80 next_file_server else "#{next_file_server}:#{self.file_server_port}" end end |
#next_file_server ⇒ Object
18 19 20 21 22 23 |
# File 'lib/distributed_cache/config.rb', line 18 def next_file_server @first_file_server_idx ||= rand(self.file_servers.size) self.file_servers[@first_file_server_idx].tap do @first_file_server_idx = (@first_file_server_idx + 1) % self.file_servers.size end end |