obfs 0.1.0 → 0.1.1
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 +8 -3
- data/lib/{main → obfs}/store.rb +10 -8
- data/lib/{main → text}/levenshtein.rb +5 -1
- data/lib/{main → text}/white_similarity.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 704cf6c36b527d888d2a755f3b41f56c94a9f121543e8337e7d9b8afb28f32b0
|
4
|
+
data.tar.gz: 4a9ed29dd0f313ca5ced039ef1d6900e02d9cede067e5d537596be532a23c57f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2eddd3da38dc73e10715018286734ce0170b17ae73b6e459aa9faa9ca1ac94e27e4a3420423ff3b3a47fc84307d0f1f3caac2ad673bda405968cfe379f97f81
|
7
|
+
data.tar.gz: 3f2a4e93c277de2b09e449d3a2b05a5676e854ef511d5157cbbd908cec27308714e2ca5a685f9234aa21d648ccf31474396d15a063a780aed8039dded6df7644
|
data/lib/obfs.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# core
|
1
2
|
require 'fileutils'
|
2
3
|
require 'json'
|
3
4
|
require 'set'
|
4
|
-
|
5
|
-
|
6
|
-
require '
|
5
|
+
|
6
|
+
# obfs
|
7
|
+
require 'obfs/store'
|
8
|
+
|
9
|
+
# third party
|
10
|
+
require 'text/levenshtein'
|
11
|
+
require 'text/white_similarity'
|
data/lib/{main → obfs}/store.rb
RENAMED
@@ -101,12 +101,16 @@ module OBFS
|
|
101
101
|
|
102
102
|
# searches directory contents (1 level) and returns boolean if term exist
|
103
103
|
def _exist(term = '')
|
104
|
-
exist_space = Dir.entries(@path).reject { |k| k != term.to_s || k == '.' || k == '..' }
|
105
|
-
if exist_space.
|
106
|
-
|
104
|
+
exist_space = Dir.entries(@path).reject { |k| k != term.to_s || k == '.' || k == '..' } rescue nil
|
105
|
+
if !exist_space.nil?
|
106
|
+
if exist_space.length > 0
|
107
|
+
true
|
108
|
+
else
|
109
|
+
false
|
110
|
+
end
|
107
111
|
else
|
108
112
|
false
|
109
|
-
end
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
private
|
@@ -114,10 +118,8 @@ module OBFS
|
|
114
118
|
# filesystem R/W
|
115
119
|
|
116
120
|
def write(path, filename, data)
|
117
|
-
|
118
|
-
|
119
|
-
File.write(curr_path, JSON.unparse(data))
|
120
|
-
}
|
121
|
+
curr_path = File.join path, filename
|
122
|
+
File.write(curr_path, JSON.unparse(data))
|
121
123
|
end
|
122
124
|
|
123
125
|
def read(path, filename)
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
module OBFS # :nodoc:
|
18
|
+
|
18
19
|
module Levenshtein
|
19
20
|
|
20
21
|
# Calculate the Levenshtein distance between two strings +str1+ and +str2+.
|
@@ -38,6 +39,7 @@ module OBFS # :nodoc:
|
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
42
|
+
|
41
43
|
def distance_with_maximum(str1, str2, max_distance) # :nodoc:
|
42
44
|
s = str1.encode(Encoding::UTF_8).unpack("U*")
|
43
45
|
t = str2.encode(Encoding::UTF_8).unpack("U*")
|
@@ -158,5 +160,7 @@ module OBFS # :nodoc:
|
|
158
160
|
end
|
159
161
|
|
160
162
|
extend self
|
163
|
+
|
161
164
|
end
|
162
|
-
|
165
|
+
|
166
|
+
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jensel Gatchalian
|
@@ -16,10 +16,10 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
- lib/main/levenshtein.rb
|
20
|
-
- lib/main/store.rb
|
21
|
-
- lib/main/white_similarity.rb
|
22
19
|
- lib/obfs.rb
|
20
|
+
- lib/obfs/store.rb
|
21
|
+
- lib/text/levenshtein.rb
|
22
|
+
- lib/text/white_similarity.rb
|
23
23
|
homepage: https://github.com/jenselg/obfs-ruby
|
24
24
|
licenses:
|
25
25
|
- MIT
|
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
|
-
rubygems_version: 3.
|
42
|
+
rubygems_version: 3.2.3
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: OBFS
|