Class: Plywood::NamedIO
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Plywood::NamedIO
- Defined in:
- lib/plywood/named_io.rb
Overview
This class is used as a wrapper around an io. It adds extra methods that are useful to distinguish it from other IOs in an efficient way.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #err? ⇒ Boolean
-
#initialize(io, name, stream) ⇒ NamedIO
constructor
A new instance of NamedIO.
- #out? ⇒ Boolean
Constructor Details
#initialize(io, name, stream) ⇒ NamedIO
9 10 11 12 13 14 |
# File 'lib/plywood/named_io.rb', line 9 def initialize(io, name, stream) super(io) @name = name.to_s @stream = stream.to_sym validate_stream end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/plywood/named_io.rb', line 7 def name @name end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
7 8 9 |
# File 'lib/plywood/named_io.rb', line 7 def stream @stream end |
Instance Method Details
#err? ⇒ Boolean
16 17 18 |
# File 'lib/plywood/named_io.rb', line 16 def err? @stream == :err end |
#out? ⇒ Boolean
20 21 22 |
# File 'lib/plywood/named_io.rb', line 20 def out? @stream == :out end |