Sha256: b52e9bfb69e1e1211b2c15151644cb2b85b3a0f43e65f669ee7c6eb864b9df93

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

module MultiEncoder
  class AbstractImage

    OUTPUT_FORMAT = 'png'

    def initialize(string, options = {})
      @contents = string
      @options = options
      choose_storage
    end

    def href
      write unless exists?
      url
    end

    private
    def fingerprint
      Digest::MD5.hexdigest(@contents)[0,9].scan(/.../)
    end

    def choose_storage
      storage = case MultiEncoder::Storage.destination
                when :filesystem
                  MultiEncoder::Storage::FileSystem
                when :aws
                  MultiEncoder::Storage::AWS
                end
      self.class.send :include, storage
    end

    private
    def eps_path
      "/tmp/#{@contents}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.eps"
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
barcode_encoder-0.0.9 lib/multi_encoder/images/abstract.rb
multi_encoder-0.0.9 lib/multi_encoder/images/abstract.rb
multi_encoder-0.0.8 lib/multi_encoder/images/abstract.rb
multi_encoder-0.0.7 lib/multi_encoder/images/abstract.rb