Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/helpers/ruby_1.8_1.9_compatibility.rb,
lib/helpers/ruby_1.8_1.9_compatibility.rb
Instance Method Summary collapse
-
#get_byte ⇒ Object
in older Ruby versions <1.9 getc returned a byte, e.g.
-
#read_bytes(n) ⇒ Object
returns a string containing bytes.
- #write_bytes(bytes) ⇒ Object
Instance Method Details
#get_byte ⇒ Object
in older Ruby versions <1.9 getc returned a byte, e.g. a number 0..255
56 57 58 |
# File 'lib/helpers/ruby_1.8_1.9_compatibility.rb', line 56 def get_byte self.getbyte # returns a number 0..255 end |
#read_bytes(n) ⇒ Object
returns a string containing bytes
17 18 19 20 21 |
# File 'lib/helpers/ruby_1.8_1.9_compatibility.rb', line 17 def read_bytes(n) # returns a string containing bytes # self.read(n) # self.sysread(n) self.bytes.take(n) end |
#write_bytes(bytes) ⇒ Object
22 23 24 |
# File 'lib/helpers/ruby_1.8_1.9_compatibility.rb', line 22 def write_bytes(bytes) self.syswrite(bytes) end |