Module: PushType::MediaUrlHelper
- Includes:
- ActionView::Helpers::AssetUrlHelper
- Defined in:
- app/helpers/push_type/media_url_helper.rb
Constant Summary collapse
- URI_REGEXP =
%r{^https?://}i
Instance Method Summary collapse
Instance Method Details
#media_path(source, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/push_type/media_url_helper.rb', line 8 def media_path(source, = {}) file_uid = source.try(:file_uid) || source path = main_app.media_path(file_uid, ) if host = compute_asset_host(path, ) url = File.join(host, path) else path end end |
#media_url(source, options = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'app/helpers/push_type/media_url_helper.rb', line 19 def media_url(source, = {}) file_uid = source.try(:file_uid) || source path = media_path(source) return path if path =~ URI_REGEXP main_app.media_url(file_uid, ) end |