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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1e900423f8d6d0f9a467d611d6a4af2bb370b6e68d86aa416be37facabe3d32
4
- data.tar.gz: 0e675fcbf20eef86fcc09615e66d745026fd3945a3437787e5a96cc183ca705c
3
+ metadata.gz: 704cf6c36b527d888d2a755f3b41f56c94a9f121543e8337e7d9b8afb28f32b0
4
+ data.tar.gz: 4a9ed29dd0f313ca5ced039ef1d6900e02d9cede067e5d537596be532a23c57f
5
5
  SHA512:
6
- metadata.gz: 03650e01c5346d2206c9d3805f83ad76496dcefc31ea0354a5432fddaf550f4c9580768231ea0fa47e35038abeb90cef2e054d242c37d1688d1c5760a7c0f779
7
- data.tar.gz: 4d7eec2c13212cf38c7a7974c122b2280a6867d7bc5672a10544d2a85d2e072c1a06fe22296408b4a1f51e2c98e790f11602d330078fc8b3098392930a289d22
6
+ metadata.gz: c2eddd3da38dc73e10715018286734ce0170b17ae73b6e459aa9faa9ca1ac94e27e4a3420423ff3b3a47fc84307d0f1f3caac2ad673bda405968cfe379f97f81
7
+ data.tar.gz: 3f2a4e93c277de2b09e449d3a2b05a5676e854ef511d5157cbbd908cec27308714e2ca5a685f9234aa21d648ccf31474396d15a063a780aed8039dded6df7644
@@ -1,6 +1,11 @@
1
+ # core
1
2
  require 'fileutils'
2
3
  require 'json'
3
4
  require 'set'
4
- require 'main/store'
5
- require 'main/levenshtein'
6
- require 'main/white_similarity'
5
+
6
+ # obfs
7
+ require 'obfs/store'
8
+
9
+ # third party
10
+ require 'text/levenshtein'
11
+ require 'text/white_similarity'
@@ -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.length > 0
106
- true
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
- Thread.new {
118
- curr_path = File.join path, filename
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
- end
165
+
166
+ end
@@ -62,4 +62,5 @@ module OBFS
62
62
  end
63
63
 
64
64
  end
65
+
65
66
  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.0
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.0.8
42
+ rubygems_version: 3.2.3
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: OBFS