Class: Vpim::Attachment::Uri
- Inherits:
-
Object
- Object
- Vpim::Attachment::Uri
- Defined in:
- lib/vpim/attachment.rb
Overview
Encapsulates a URI and implements some methods of String.
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
The format of the data referred to by the URI.
-
#uri ⇒ Object
readonly
The URI value.
Instance Method Summary collapse
-
#initialize(uri, format) ⇒ Uri
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
-
#to_io ⇒ Object
Return an IO object from opening the URI.
-
#to_s ⇒ Object
Return the String from reading the IO object to end-of-data.
Constructor Details
#initialize(uri, format) ⇒ Uri
:nodoc:
71 72 73 74 |
# File 'lib/vpim/attachment.rb', line 71 def initialize(uri, format) #:nodoc: @uri = uri @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
The format of the data referred to by the URI. See Attachment.
81 82 83 |
# File 'lib/vpim/attachment.rb', line 81 def format @format end |
#uri ⇒ Object (readonly)
The URI value.
77 78 79 |
# File 'lib/vpim/attachment.rb', line 77 def uri @uri end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
94 95 96 97 98 |
# File 'lib/vpim/attachment.rb', line 94 def inspect #:nodoc: s = "<#{self.class.to_s}: #{uri.inspect}>" s << ", #{@format.inspect}" if @format s end |
#to_io ⇒ Object
Return an IO object from opening the URI. See open-uri
for more information.
85 86 87 |
# File 'lib/vpim/attachment.rb', line 85 def to_io open(@uri) end |
#to_s ⇒ Object
Return the String from reading the IO object to end-of-data.
90 91 92 |
# File 'lib/vpim/attachment.rb', line 90 def to_s to_io.read(nil) end |