Class: Associo::IO

Inherits:
Object
  • Object
show all
Defined in:
lib/associo/io.rb

Overview

Defines the file io for the attached file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ IO

Returns a new instance of IO.



8
9
10
11
12
# File 'lib/associo/io.rb', line 8

def initialize(attrs = {})
  attrs.each { |key, value| send("#{key}=", value) }

  @type ||= 'plain/text'
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



6
7
8
# File 'lib/associo/io.rb', line 6

def content
  @content
end

#nameObject Also known as: path

Returns the value of attribute name.



6
7
8
# File 'lib/associo/io.rb', line 6

def name
  @name
end

#sizeObject

Returns the value of attribute size.



6
7
8
# File 'lib/associo/io.rb', line 6

def size
  @size
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/associo/io.rb', line 6

def type
  @type
end

Instance Method Details

#read(*args) ⇒ Object



19
20
21
# File 'lib/associo/io.rb', line 19

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

#rewindObject



23
24
25
# File 'lib/associo/io.rb', line 23

def rewind
  @io.rewind if @io.respond_to?(:rewind)
end