Class: IO

Inherits:
Object show all
Defined in:
opal/stdlib/nodejs/io.rb

Direct Known Subclasses

File, StringIO

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeIO

Returns a new instance of IO.



25
26
27
28
# File 'opal/stdlib/nodejs/io.rb', line 25

def initialize
  @eof = false
  @lineno = 0
end

Instance Attribute Details

#eofObject (readonly)

Returns the value of attribute eof.



22
23
24
# File 'opal/stdlib/nodejs/io.rb', line 22

def eof
  @eof
end

#linenoObject (readonly)

Returns the value of attribute lineno.



23
24
25
# File 'opal/stdlib/nodejs/io.rb', line 23

def lineno
  @lineno
end

Class Method Details

.binread(path) ⇒ Object



38
39
40
# File 'opal/stdlib/nodejs/io.rb', line 38

def self.binread(path)
  `return executeIOAction(function(){return __fs__.readFileSync(#{path}).toString('binary')})`
end

.read(path) ⇒ Object



34
35
36
# File 'opal/stdlib/nodejs/io.rb', line 34

def self.read(path)
  File.read(path)
end

.write(path, data) ⇒ Object



30
31
32
# File 'opal/stdlib/nodejs/io.rb', line 30

def self.write(path, data)
  File.write(path, data)
end