Class: MPLight::BufferIO

Inherits:
Object
  • Object
show all
Defined in:
lib/mplight/bufferio.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/mplight/bufferio.rb', line 10

def data
  @data
end

Instance Method Details

#binmodeObject



16
17
18
# File 'lib/mplight/bufferio.rb', line 16

def binmode
  @data.force_encoding Encoding::ASCII_8BIT
end

#flushObject



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

#syncObject



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