Sha256: 5ecc4fb9e8d66ea8952892591906b3872249e0c0486c5934906cc3d707b4ec51

Contents?: true

Size: 664 Bytes

Versions: 6

Compression:

Stored size: 664 Bytes

Contents

# encoding: utf-8

module CarrierWave
  module Uploader
    module Url

      ##
      # === Returns
      #
      # [String] the location where this file is accessible via a url
      #
      def url
        if file.respond_to?(:url) and not file.url.blank?
          file.url
        elsif current_path
          File.expand_path(current_path).gsub(File.expand_path(root), '')
        end
      end

      alias_method :to_s, :url

      ##
      # === Returns
      #
      # [String] A JSON serializtion containing this uploader's URL
      #
      def as_json(options = nil)
        { :url => url }
      end

    end # Url
  end # Uploader
end # CarrierWave

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
locomotive_carrierwave-0.5.0.1.beta3 lib/carrierwave/uploader/url.rb
carrierwave-0.5.2 lib/carrierwave/uploader/url.rb
carrierwave-0.5.1 lib/carrierwave/uploader/url.rb
locomotive_carrierwave-0.5.0.1.beta2 lib/carrierwave/uploader/url.rb
locomotive_carrierwave-0.5.0.1.beta1 lib/carrierwave/uploader/url.rb
locomotive_carrierwave-0.5.0.1 lib/carrierwave/uploader/url.rb