Sha256: de26fad8498c77ce9c359f9fb58eb36565c9f80f40f96e8be79ce50212594e61

Contents?: true

Size: 562 Bytes

Versions: 4

Compression:

Stored size: 562 Bytes

Contents

module MultiEncoder
  module Storage
    module FileSystem

      def url
        if defined? Rails
          file_path.to_s.gsub Rails.root.join('public').to_s, ''
        end
      end

      def root
        defined?(Rails) ? Rails.root : Pathname.new('/tmp')
      end

      def directory
        root.join 'public', 'system', type, *fingerprint
      end

      def file_path
        Pathname.new "#{directory.join(@contents)}.#{MultiEncoder::BarcodeImage::OUTPUT_FORMAT}"
      end

      def exists?
        file_path.exist?
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
barcode_encoder-0.0.9 lib/multi_encoder/storage/filesystem.rb
multi_encoder-0.0.9 lib/multi_encoder/storage/filesystem.rb
multi_encoder-0.0.8 lib/multi_encoder/storage/filesystem.rb
multi_encoder-0.0.7 lib/multi_encoder/storage/filesystem.rb