Class: File::Stat
- Defined in:
- opal/stdlib/deno/file.rb,
opal/stdlib/nodejs/file.rb
Instance Method Summary collapse
- #directory? ⇒ Boolean
- #executable? ⇒ Boolean
- #file? ⇒ Boolean
-
#initialize(path) ⇒ Stat
constructor
A new instance of Stat.
- #mtime ⇒ Object
- #readable? ⇒ Boolean
- #writable? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ Stat
Returns a new instance of Stat.
304 305 306 |
# File 'opal/stdlib/deno/file.rb', line 304 def initialize(path) @path = path end |
Instance Method Details
#directory? ⇒ Boolean
312 313 314 |
# File 'opal/stdlib/deno/file.rb', line 312 def directory? `return executeIOAction(function(){return Deno.statSync(#{@path}).isDirectory})` end |
#executable? ⇒ Boolean
338 339 340 341 |
# File 'opal/stdlib/deno/file.rb', line 338 def executable? # accessible only over unstable API false end |
#file? ⇒ Boolean
308 309 310 |
# File 'opal/stdlib/deno/file.rb', line 308 def file? `return executeIOAction(function(){return Deno.statSync(#{@path}).isFile})` end |
#mtime ⇒ Object
316 317 318 |
# File 'opal/stdlib/deno/file.rb', line 316 def mtime `return executeIOAction(function(){return Deno.statSync(#{@path}).mtime})` end |
#readable? ⇒ Boolean
320 321 322 323 324 325 326 327 |
# File 'opal/stdlib/deno/file.rb', line 320 def readable? %x{ return executeIOAction(function(){ Deno.openSync(path, {read: true}).close(); return true; }) } end |
#writable? ⇒ Boolean
329 330 331 332 333 334 335 336 |
# File 'opal/stdlib/deno/file.rb', line 329 def writable? %x{ return executeIOAction(function(){ Deno.openSync(path, {write: true}).close(); return true; }) } end |