Class: BRS::Stream::Abstract
- Inherits:
-
Object
- Object
- BRS::Stream::Abstract
- Includes:
- Delegates
- Defined in:
- lib/brs/stream/abstract.rb
Constant Summary
Constants included from Delegates
Instance Attribute Summary collapse
-
#external_encoding ⇒ Object
readonly
Returns the value of attribute external_encoding.
-
#internal_encoding ⇒ Object
readonly
Returns the value of attribute internal_encoding.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#pos ⇒ Object
(also: #tell)
readonly
Returns the value of attribute pos.
-
#stat ⇒ Object
readonly
Returns the value of attribute stat.
-
#transcode_options ⇒ Object
readonly
Returns the value of attribute transcode_options.
Instance Method Summary collapse
- #advise ⇒ Object
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#initialize(io, options = {}) ⇒ Abstract
constructor
A new instance of Abstract.
-
#rewind ⇒ Object
– etc –.
-
#set_encoding(*args) ⇒ Object
– encoding –.
- #to_io ⇒ Object
Methods included from Delegates
Constructor Details
#initialize(io, options = {}) ⇒ Abstract
Returns a new instance of Abstract.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/brs/stream/abstract.rb', line 29 def initialize(io, = {}) @raw_stream = create_raw_stream Validation.validate_io io @io = io @stat = Stat.new @io.stat if @io.respond_to? :stat set_encoding [:external_encoding], [:internal_encoding], [:transcode_options] reset_buffer reset_io_advise @pos = 0 end |
Instance Attribute Details
#external_encoding ⇒ Object (readonly)
Returns the value of attribute external_encoding.
22 23 24 |
# File 'lib/brs/stream/abstract.rb', line 22 def external_encoding @external_encoding end |
#internal_encoding ⇒ Object (readonly)
Returns the value of attribute internal_encoding.
23 24 25 |
# File 'lib/brs/stream/abstract.rb', line 23 def internal_encoding @internal_encoding end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
20 21 22 |
# File 'lib/brs/stream/abstract.rb', line 20 def io @io end |
#pos ⇒ Object (readonly) Also known as: tell
Returns the value of attribute pos.
25 26 27 |
# File 'lib/brs/stream/abstract.rb', line 25 def pos @pos end |
#stat ⇒ Object (readonly)
Returns the value of attribute stat.
21 22 23 |
# File 'lib/brs/stream/abstract.rb', line 21 def stat @stat end |
#transcode_options ⇒ Object (readonly)
Returns the value of attribute transcode_options.
24 25 26 |
# File 'lib/brs/stream/abstract.rb', line 24 def end |
Instance Method Details
#advise ⇒ Object
59 60 61 62 |
# File 'lib/brs/stream/abstract.rb', line 59 def advise # Noop nil end |
#close ⇒ Object
140 141 142 143 144 |
# File 'lib/brs/stream/abstract.rb', line 140 def close @io.close nil end |
#closed? ⇒ Boolean
146 147 148 |
# File 'lib/brs/stream/abstract.rb', line 146 def closed? @raw_stream.closed? && @io.closed? end |
#rewind ⇒ Object
– etc –
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/brs/stream/abstract.rb', line 127 def rewind @raw_stream = create_raw_stream @io.rewind if @io.respond_to? :rewind reset_buffer reset_io_advise @pos = 0 0 end |
#set_encoding(*args) ⇒ Object
– encoding –
66 67 68 69 70 71 72 73 74 |
# File 'lib/brs/stream/abstract.rb', line 66 def set_encoding(*args) external_encoding, internal_encoding, = process_set_encoding_arguments(*args) set_target_encoding :@external_encoding, external_encoding set_target_encoding :@internal_encoding, internal_encoding = self end |
#to_io ⇒ Object
150 151 152 |
# File 'lib/brs/stream/abstract.rb', line 150 def to_io self end |