Class: Shutterbug::Handlers::JsFileHandler
- Inherits:
-
Object
- Object
- Shutterbug::Handlers::JsFileHandler
- Defined in:
- lib/shutterbug/handlers/js_file_handler.rb
Class Method Summary collapse
Instance Method Summary collapse
- #handle(helper, req, env) ⇒ Object
-
#initialize(_config = Configuration.instance()) ⇒ JsFileHandler
constructor
A new instance of JsFileHandler.
- #js_file ⇒ Object
- #regex ⇒ Object
Constructor Details
#initialize(_config = Configuration.instance()) ⇒ JsFileHandler
Returns a new instance of JsFileHandler.
17 18 19 20 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 17 def initialize(_config=Configuration.instance()) @config = _config @javascript = File.read(js_file).gsub(/CONVERT_PATH/,@config.convert_path) end |
Class Method Details
.js_path ⇒ Object
5 6 7 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 5 def self.js_path "#{Configuration.instance.url_prefix}/shutterbug.js" end |
Instance Method Details
#handle(helper, req, env) ⇒ Object
22 23 24 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 22 def handle(helper, req, env) helper.good_response(@javascript, 'application/javascript') end |
#js_file ⇒ Object
13 14 15 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 13 def js_file File.join(File.dirname(__FILE__),"shutterbug.js") end |
#regex ⇒ Object
9 10 11 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 9 def regex /#{@config.path_prefix}\/shutterbug.js/ end |