Class: Dragonfly::Cache::Config
- Inherits:
-
Object
- Object
- Dragonfly::Cache::Config
- Defined in:
- lib/dragonfly/cache/config.rb
Instance Attribute Summary collapse
-
#servers_options ⇒ Object
Returns the value of attribute servers_options.
Instance Method Summary collapse
- #base_dir ⇒ Object
-
#initialize(servers_options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(servers_options = {}) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 14 15 16 |
# File 'lib/dragonfly/cache/config.rb', line 8 def initialize( = {}) self. = { url_format: '/dragonfly-cache/:sha/:name', server_root: File.join(Dir.pwd, 'public') }.merge() validate! rewrite_url_format! end |
Instance Attribute Details
#servers_options ⇒ Object
Returns the value of attribute servers_options.
6 7 8 |
# File 'lib/dragonfly/cache/config.rb', line 6 def @servers_options end |
Instance Method Details
#base_dir ⇒ Object
18 19 20 21 22 23 |
# File 'lib/dragonfly/cache/config.rb', line 18 def base_dir @base_dir ||= begin path_format = File.join([:server_root], [:url_format]) path_format.split('/').take_while { |p| p != ':shaish' }.join('/') end end |