Class: Shutterbug::Handlers::FileHandlers::Base
- Inherits:
-
Object
- Object
- Shutterbug::Handlers::FileHandlers::Base
- Defined in:
- lib/shutterbug/handlers/file_handlers/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #filename(base) ⇒ Object
- #filename_matcher ⇒ Object
-
#initialize(_config = Configuration.instance) ⇒ Base
constructor
A new instance of Base.
- #path_prefix ⇒ Object
- #regex ⇒ Object
- #urlify(name) ⇒ Object
Constructor Details
#initialize(_config = Configuration.instance) ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 12 def initialize(_config = Configuration.instance) self.config = _config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 6 def config @config end |
Class Method Details
.instance ⇒ Object
8 9 10 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 8 def self.instance return @instance || self.new end |
Instance Method Details
#filename(base) ⇒ Object
32 33 34 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 32 def filename(base) "#{base}.#{file_extension}" end |
#filename_matcher ⇒ Object
24 25 26 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 24 def filename_matcher "(([^\/|\.]+)\.?([^\/]+))?" end |
#path_prefix ⇒ Object
20 21 22 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 20 def path_prefix "#{self.config.path_prefix}/get_#{file_extension}" end |
#regex ⇒ Object
28 29 30 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 28 def regex /#{path_prefix}\/#{filename_matcher}/ end |
#urlify(name) ⇒ Object
16 17 18 |
# File 'lib/shutterbug/handlers/file_handlers/base.rb', line 16 def urlify(name) "#{self.config.uri_prefix}#{self.path_prefix}/#{name}" end |