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

#initialize(fd, flags = 'r') ⇒ IO

Returns a new instance of IO.



27
28
29
30
# File 'opal/stdlib/nodejs/io.rb', line 27

def initialize(fd, flags = 'r')
  @lineno = 0
  initialize_before_node_io(fd, flags)
end

Instance Attribute Details

#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



40
41
42
# File 'opal/stdlib/nodejs/io.rb', line 40

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

.read(path) ⇒ Object



36
37
38
# File 'opal/stdlib/nodejs/io.rb', line 36

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

.write(path, data) ⇒ Object



32
33
34
# File 'opal/stdlib/nodejs/io.rb', line 32

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

Instance Method Details

#initialize_before_node_ioObject



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

alias initialize_before_node_io initialize