obfs 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/obfs.rb +18 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62ca2bff9fda087f834b3823adac6a193fd419c78e3dd72bdbf37b4b104c0e00
|
4
|
+
data.tar.gz: 07a819a4eb162a7bcbc43d3310f1a68ed4c6dd35b7cc1a333b69b57d536fc8bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df53e0a7fed4b2f6e2b78fabe11ac0e40acc055128eff51119b9f615a25fe5bfe61becbac770043422c958d6ecc43fbb11b091fcfca68d91a5adf836d3320675
|
7
|
+
data.tar.gz: 45765a1f45e9b0969c8597003ca1f4b8e56fcc8bdba79bc5c6a326653b2cd2d682837d3e1d7e928226a40f2d32bef3426c2ccb7569bf2bfc3378907843c346af
|
data/lib/obfs.rb
CHANGED
@@ -36,9 +36,9 @@ class OBFS
|
|
36
36
|
|
37
37
|
# write data
|
38
38
|
if data == nil
|
39
|
-
FileUtils.rm_rf File.join @path, method_name
|
39
|
+
FileUtils.rm_rf (File.join @path, method_name)
|
40
40
|
else
|
41
|
-
FileUtils.rm_rf @path, method_name if File.exist? File.join @path, method_name
|
41
|
+
FileUtils.rm_rf (File.join @path, method_name) if File.exist? (File.join @path, method_name)
|
42
42
|
FileUtils.mkpath @path if !File.directory? @path
|
43
43
|
write(@path, method_name, data)
|
44
44
|
end
|
@@ -79,7 +79,7 @@ class OBFS
|
|
79
79
|
end
|
80
80
|
|
81
81
|
# searches directory contents (1 level) and returns array sorted by relevance
|
82
|
-
def _find(term = '', records =
|
82
|
+
def _find(term = '', records = 1000, tolerance = 10)
|
83
83
|
output = []
|
84
84
|
search_space = Dir.entries(@path).reject { |k| k == '.' || k == '..' } rescue []
|
85
85
|
search_space.each do |search_space_term|
|
@@ -88,15 +88,27 @@ class OBFS
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
output.first(records)
|
91
|
-
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# searches directory contents (1 level) and returns boolean if term exist
|
94
|
+
def _exist(term = '')
|
95
|
+
exist_space = Dir.entries(@path).reject { |k| k != term.to_s }
|
96
|
+
if exist_space.length > 0
|
97
|
+
true
|
98
|
+
else
|
99
|
+
false
|
100
|
+
end
|
101
|
+
end
|
92
102
|
|
93
103
|
private
|
94
104
|
|
95
105
|
# filesystem R/W
|
96
106
|
|
97
107
|
def write(path, filename, data)
|
98
|
-
|
99
|
-
|
108
|
+
Thread.new {
|
109
|
+
curr_path = File.join path, filename
|
110
|
+
File.write(curr_path, JSON.unparse(data))
|
111
|
+
}
|
100
112
|
end
|
101
113
|
|
102
114
|
def read(path, filename)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jensel Gatchalian
|
@@ -17,7 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/obfs.rb
|
20
|
-
homepage: https://
|
20
|
+
homepage: https://github.com/jenselg/obfs-ruby
|
21
21
|
licenses:
|
22
22
|
- MIT
|
23
23
|
metadata: {}
|