Sha256: 90a962cd838d0a17c18adac7c8c6651dca152b2996188d438a482f5292553f90

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

module PushType
  module MediaUrlHelper

    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

3 entries across 3 versions & 1 rubygems

Version Path
push_type_core-0.10.0 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.0.beta.5 app/helpers/push_type/media_url_helper.rb
push_type_core-0.10.0.beta.3 app/helpers/push_type/media_url_helper.rb