Class: Libuv::Filesystem
Constant Summary
Constants included
from Assertions
Assertions::MSG_NO_PROC
Instance Method Summary
collapse
Methods included from Assertions
#assert_block, #assert_boolean, #assert_type
Methods included from Resource
#check_result, #check_result!, #resolve, #to_ptr
Methods included from FsChecks
#stat
Constructor Details
Returns a new instance of Filesystem.
6
7
8
|
# File 'lib/libuv/filesystem.rb', line 6
def initialize(loop)
@loop = loop
end
|
Instance Method Details
#chmod(path, mode) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/libuv/filesystem.rb', line 57
def chmod(path, mode)
assert_type(String, path, "path must be a String")
assert_type(Integer, mode, "mode must be an Integer")
@chmod_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @chmod_deferred, request, ::Libuv::Ext.fs_chmod(@loop, request, path, mode, callback(:on_chmod))
@chmod_deferred.promise
end
|
#chown(path, uid, gid) ⇒ Object
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/libuv/filesystem.rb', line 116
def chown(path, uid, gid)
assert_type(String, path, "path must be a String")
assert_type(Integer, uid, "uid must be an Integer")
assert_type(Integer, gid, "gid must be an Integer")
@chown_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @chown_deferred, request, ::Libuv::Ext.fs_chown(@loop, request, path, uid, gid, callback(:on_chown))
@chown_deferred.promise
end
|
#link(old_path, new_path) ⇒ Object
87
88
89
90
91
92
93
94
95
|
# File 'lib/libuv/filesystem.rb', line 87
def link(old_path, new_path)
assert_type(String, old_path, "old_path must be a String")
assert_type(String, new_path, "new_path must be a String")
@link_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @link_deferred, request, ::Libuv::Ext.fs_link(@loop, request, old_path, new_path, callback(:on_link))
@link_deferred.promise
end
|
#lstat(path) ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/libuv/filesystem.rb', line 78
def lstat(path)
assert_type(String, path, "path must be a String")
@stat_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @stat_deferred, request, ::Libuv::Ext.fs_lstat(@loop, request, path, callback(:on_stat))
@stat_deferred.promise
end
|
#mkdir(path, mode = 0777) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/libuv/filesystem.rb', line 19
def mkdir(path, mode = 0777)
assert_type(String, path, "path must be a String")
assert_type(Integer, mode, "mode must be an Integer")
@mkdir_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @mkdir_deferred, request, ::Libuv::Ext.fs_mkdir(@loop, request, path, mode, callback(:on_mkdir))
@mkdir_deferred.promise
end
|
#readdir(path) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/libuv/filesystem.rb', line 38
def readdir(path)
assert_type(String, path, "path must be a String")
@readdir_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @readdir_deferred, request, ::Libuv::Ext.fs_readdir(@loop, request, path, 0, callback(:on_readdir))
@readdir_deferred.promise
end
|
#readlink(path) ⇒ Object
107
108
109
110
111
112
113
114
|
# File 'lib/libuv/filesystem.rb', line 107
def readlink(path)
assert_type(String, path, "path must be a String")
@readlink_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @readlink_deferred, request, ::Libuv::Ext.fs_readlink(@loop, request, path, callback(:on_readlink))
@readlink_deferred.promise
end
|
#rename(old_path, new_path) ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/libuv/filesystem.rb', line 47
def rename(old_path, new_path)
assert_type(String, old_path, "old_path must be a String")
assert_type(String, new_path, "new_path must be a String")
@rename_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @rename_deferred, request, ::Libuv::Ext.fs_rename(@loop, request, old_path, new_path, callback(:on_rename))
@rename_deferred.promise
end
|
#rmdir(path) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/libuv/filesystem.rb', line 29
def rmdir(path)
assert_type(String, path, "path must be a String")
@rmdir_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @rmdir_deferred, request, ::Libuv::Ext.fs_rmdir(@loop, request, path, callback(:on_rmdir))
@rmdir_deferred.promise
end
|
#symlink(old_path, new_path) ⇒ Object
97
98
99
100
101
102
103
104
105
|
# File 'lib/libuv/filesystem.rb', line 97
def symlink(old_path, new_path)
assert_type(String, old_path, "old_path must be a String")
assert_type(String, new_path, "new_path must be a String")
@symlink_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @symlink_deferred, request, ::Libuv::Ext.fs_symlink(@loop, request, old_path, new_path, 0, callback(:on_symlink))
@symlink_deferred.promise
end
|
#unlink(path) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/libuv/filesystem.rb', line 10
def unlink(path)
assert_type(String, path, "path must be a String")
@unlink_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @unlink_deferred, request, ::Libuv::Ext.fs_unlink(@loop, request, path, callback(:on_unlink))
@unlink_deferred.promise
end
|
#utime(path, atime, mtime) ⇒ Object
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/libuv/filesystem.rb', line 67
def utime(path, atime, mtime)
assert_type(String, path, "path must be a String")
assert_type(Integer, atime, "atime must be an Integer")
assert_type(Integer, mtime, "mtime must be an Integer")
@utime_deferred = @loop.defer
request = ::Libuv::Ext.create_request(:uv_fs)
pre_check @utime_deferred, request, ::Libuv::Ext.fs_utime(@loop, request, path, atime, mtime, callback(:on_utime))
@utime_deferred.promise
end
|