Sha256: 51504210bf4983301a96b1a146a85d1e6edcf38bac67314f7189e244fe493996

Contents?: true

Size: 632 Bytes

Versions: 11

Compression:

Stored size: 632 Bytes

Contents

module PushType
  module MediaUrlHelper

    include ActionView::Helpers::AssetUrlHelper

    URI_REGEXP = %r{^https?://}i

    def media_path(source, options = {})
      file_uid  = source.try(:file_uid) || source
      path      = main_app.media_path(file_uid, options)

      if host = compute_asset_host(path, options)
        url = File.join(host, path)
      else
        path
      end
    end

    def media_url(source, options = {})
      file_uid  = source.try(:file_uid) || source
      path      = media_path(source)
      return path if path =~ URI_REGEXP
      main_app.media_url(file_uid, options)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
push_type_core-0.12.1 app/helpers/push_type/media_url_helper.rb
push_type_core-0.12.0 app/helpers/push_type/media_url_helper.rb
push_type_core-0.12.0.beta.1 app/helpers/push_type/media_url_helper.rb
push_type_core-0.11.2 app/helpers/push_type/media_url_helper.rb
push_type_core-0.11.1 app/helpers/push_type/media_url_helper.rb
push_type_core-0.11.0.beta.2 app/helpers/push_type/media_url_helper.rb
push_type_core-0.11.0.beta.1 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.4 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.3 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.2 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.1 app/helpers/push_type/media_url_helper.rb