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.



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

def initialize(path)
  @path = path
end

Instance Method Details

#directory?Boolean

Returns:



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

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

#executable?Boolean

Returns:



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

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

#file?Boolean

Returns:



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

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

#mtimeObject



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

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

#readable?Boolean

Returns:



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

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

#writable?Boolean

Returns:



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

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