Sha256: beb8ccad1da594659963be07256374a704fe892cae49d349dcea8a243b1d5016

Contents?: true

Size: 406 Bytes

Versions: 4

Compression:

Stored size: 406 Bytes

Contents

require 'stringio'

module Joint
  class IO
    attr_accessor :name, :content, :type, :size

    def initialize(attrs={})
      attrs.each { |key, value| send("#{key}=", value) }
      @type ||= 'plain/text'
    end

    def content=(value)
      @io = StringIO.new(value || nil)
      @size = value ? value.size : 0
    end

    def read(*args)
      @io.read(*args)
    end

    alias path name
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
joint-0.6.2 lib/joint/io.rb
joint-0.6.1 lib/joint/io.rb
jamieorc-joint-0.6.1 lib/joint/io.rb
joint-0.6.0 lib/joint/io.rb