lib/joint/io.rb in joint-0.5.5 vs lib/joint/io.rb in joint-0.6.0

- old
+ new

@@ -1,14 +1,23 @@ +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' - @size ||= @content.size unless @content.nil? 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 - alias read content end end \ No newline at end of file