Class: Associo::IO
- Inherits:
-
Object
- Object
- Associo::IO
- Defined in:
- lib/associo/io.rb
Overview
Defines the file io for the attached file.
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#name ⇒ Object
(also: #path)
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ IO
constructor
A new instance of IO.
- #read(*args) ⇒ Object
- #rewind ⇒ Object
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
#content ⇒ Object
Returns the value of attribute content.
6 7 8 |
# File 'lib/associo/io.rb', line 6 def content @content end |
#name ⇒ Object Also known as: path
Returns the value of attribute name.
6 7 8 |
# File 'lib/associo/io.rb', line 6 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
6 7 8 |
# File 'lib/associo/io.rb', line 6 def size @size end |
#type ⇒ Object
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 |
#rewind ⇒ Object
23 24 25 |
# File 'lib/associo/io.rb', line 23 def rewind @io.rewind if @io.respond_to?(:rewind) end |