Sha256: b14cb442884da3952b9361f96d7f291a7bdee3537f65f1d352f0b0cfc898b22b

Contents?: true

Size: 745 Bytes

Versions: 12

Compression:

Stored size: 745 Bytes

Contents

require 'base64'
module Mack
  module Testing
    class FileWrapper # :nodoc:
      
      attr_reader :path
      attr_reader :file_name
      attr_reader :content
      attr_reader :size
      attr_reader :mime
      
      def initialize(path)
        @path = path
        @file_name = File.basename(path)
        extension = File.extname(path)
        extension = extension.gsub!(".", "")
        if extension and !extension.empty?
          @mime     = Mack::Utils::MimeTypes.instance.get(extension) if extension
        else
          @mime     = "application/octet-stream"
        end
        raw_content = File.read(path)
        @content = Base64.encode64(raw_content).strip
        @size    = @content.size
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mack-0.7.1.1 lib/mack/testing/file.rb
mack-0.7.0 lib/mack/testing/file.rb
mack-0.7.0.1 lib/mack/testing/file.rb
mack-0.8.0.101 lib/mack/testing/file.rb
mack-0.7.1 lib/mack/testing/file.rb
mack-0.8.0.100 lib/mack/testing/file.rb
mack-0.8.0 lib/mack/testing/file.rb
mack-0.8.0.2 lib/mack/testing/file.rb
mack-0.8.1 lib/mack/testing/file.rb
mack-0.8.2 lib/mack/testing/file.rb
mack-0.8.3 lib/mack/testing/file.rb
mack-0.8.3.1 lib/mack/testing/file.rb