Class: MPLight::BufferIO
- Inherits:
-
Object
- Object
- MPLight::BufferIO
- Defined in:
- lib/mplight/bufferio.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #binmode ⇒ Object
- #flush ⇒ Object
-
#initialize(str = nil) ⇒ BufferIO
constructor
A new instance of BufferIO.
- #read(n) ⇒ Object
- #sync ⇒ Object
- #sync=(_) ⇒ Object
- #write(d) ⇒ Object
Constructor Details
#initialize(str = nil) ⇒ BufferIO
Returns a new instance of BufferIO.
12 13 14 |
# File 'lib/mplight/bufferio.rb', line 12 def initialize str = nil @data = str||"" end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/mplight/bufferio.rb', line 10 def data @data end |
Instance Method Details
#binmode ⇒ Object
16 17 18 |
# File 'lib/mplight/bufferio.rb', line 16 def binmode @data.force_encoding Encoding::ASCII_8BIT end |
#flush ⇒ Object
30 31 |
# File 'lib/mplight/bufferio.rb', line 30 def flush end |
#read(n) ⇒ Object
26 27 28 |
# File 'lib/mplight/bufferio.rb', line 26 def read n @data.slice! 0, n end |
#sync ⇒ Object
20 |
# File 'lib/mplight/bufferio.rb', line 20 def sync ; true ; end |
#sync=(_) ⇒ Object
19 |
# File 'lib/mplight/bufferio.rb', line 19 def sync= _ ; end |
#write(d) ⇒ Object
22 23 24 |
# File 'lib/mplight/bufferio.rb', line 22 def write d @data << d end |