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.
302 303 304 |
# File 'opal/stdlib/deno/file.rb', line 302 def initialize(path) @path = path end |
Instance Method Details
#directory? ⇒ Boolean
310 311 312 |
# File 'opal/stdlib/deno/file.rb', line 310 def directory? `return executeIOAction(function(){return Deno.statSync(#{@path}).isDirectory})` end |
#executable? ⇒ Boolean
336 337 338 339 |
# File 'opal/stdlib/deno/file.rb', line 336 def executable? # accessible only over unstable API false end |
#file? ⇒ Boolean
306 307 308 |
# File 'opal/stdlib/deno/file.rb', line 306 def file? `return executeIOAction(function(){return Deno.statSync(#{@path}).isFile})` end |
#mtime ⇒ Object
314 315 316 |
# File 'opal/stdlib/deno/file.rb', line 314 def mtime `return executeIOAction(function(){return Deno.statSync(#{@path}).mtime})` end |
#readable? ⇒ Boolean
318 319 320 321 322 323 324 325 |
# File 'opal/stdlib/deno/file.rb', line 318 def readable? %x{ return executeIOAction(function(){ Deno.openSync(path, {read: true}).close(); return true; }) } end |
#writable? ⇒ Boolean
327 328 329 330 331 332 333 334 |
# File 'opal/stdlib/deno/file.rb', line 327 def writable? %x{ return executeIOAction(function(){ Deno.openSync(path, {write: true}).close(); return true; }) } end |