Class: File::Stat

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

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Stat

Returns a new instance of Stat.



312
313
314
# File 'opal/stdlib/nodejs/file.rb', line 312

def initialize(path)
  @path = path
end

Instance Method Details

#directory?Boolean

Returns:



320
321
322
# File 'opal/stdlib/nodejs/file.rb', line 320

def directory?
  `return executeIOAction(function(){return __fs__.statSync(#{@path}).isDirectory()})`
end

#executable?Boolean

Returns:



336
337
338
# File 'opal/stdlib/nodejs/file.rb', line 336

def executable?
  `return executeIOAction(function(){return __fs__.accessSync(#{@path}, __fs__.constants.X_OK)})`
end

#file?Boolean

Returns:



316
317
318
# File 'opal/stdlib/nodejs/file.rb', line 316

def file?
  `return executeIOAction(function(){return __fs__.statSync(#{@path}).isFile()})`
end

#mtimeObject



324
325
326
# File 'opal/stdlib/nodejs/file.rb', line 324

def mtime
  `return executeIOAction(function(){return __fs__.statSync(#{@path}).mtime})`
end

#readable?Boolean

Returns:



328
329
330
# File 'opal/stdlib/nodejs/file.rb', line 328

def readable?
  `return executeIOAction(function(){return __fs__.accessSync(#{@path}, __fs__.constants.R_OK)})`
end

#writable?Boolean

Returns:



332
333
334
# File 'opal/stdlib/nodejs/file.rb', line 332

def writable?
  `return executeIOAction(function(){return __fs__.accessSync(#{@path}, __fs__.constants.W_OK)})`
end