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 ⇒ JsFileHandler
constructor
A new instance of JsFileHandler.
- #js_file ⇒ Object
Constructor Details
#initialize ⇒ JsFileHandler
Returns a new instance of JsFileHandler.
17 18 19 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 17 def initialize @javascript = File.read(js_file).gsub(/URL_PREFIX/, self.class.config.url_prefix) end |
Class Method Details
.config ⇒ Object
5 6 7 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 5 def self.config Configuration.instance end |
.js_path ⇒ Object
9 10 11 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 9 def self.js_path "#{self.config.url_prefix}/shutterbug.js" end |
.regex ⇒ Object
13 14 15 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 13 def self.regex /#{self.config.path_prefix}\/shutterbug.js/ end |
Instance Method Details
#handle(helper, req, env) ⇒ Object
25 26 27 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 25 def handle(helper, req, env) helper.response(@javascript, 'application/javascript') end |
#js_file ⇒ Object
21 22 23 |
# File 'lib/shutterbug/handlers/js_file_handler.rb', line 21 def js_file File.join(File.dirname(__FILE__), "shutterbug.js") end |