Skip to content

Commit

Permalink
Merge pull request #140 from renchap/prime-dependency
Browse files Browse the repository at this point in the history
Add explicit dependency to `prime`
  • Loading branch information
grosser authored May 20, 2024
2 parents a4628d5 + 555e8a4 commit abc4bbe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
8 changes: 7 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PATH
remote: .
specs:
fast_gettext (2.3.0)
prime

GEM
remote: https://rubygems.org/
Expand All @@ -24,6 +25,7 @@ GEM
diff-lcs (1.3)
forking_test_runner (1.3.0)
parallel_tests (>= 1.3.7)
forwardable (1.3.3)
i18n (1.2.0)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.1)
Expand All @@ -33,6 +35,9 @@ GEM
parallel
parser (3.1.0.0)
ast (~> 2.4.1)
prime (0.1.2)
forwardable
singleton
rainbow (3.1.1)
rake (12.3.2)
regexp_parser (2.2.0)
Expand Down Expand Up @@ -65,6 +70,7 @@ GEM
rubocop (>= 0.89, < 2.0)
ruby-progressbar (1.11.0)
single_cov (1.3.0)
singleton (0.2.0)
sqlite3 (1.6.0)
mini_portile2 (~> 2.8.0)
thread_safe (0.3.6)
Expand All @@ -89,4 +95,4 @@ DEPENDENCIES
sqlite3

BUNDLED WITH
2.1.4
2.3.27
1 change: 1 addition & 0 deletions fast_gettext.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Gem::Specification.new name, FastGettext::VERSION do |s|
s.files = Dir["{lib/**/*.{rb,mo,rdoc},Readme.md,CHANGELOG,LICENSE}"]
s.licenses = ["MIT", "Ruby"]
s.required_ruby_version = '>= 2.5.0'
s.add_runtime_dependency 'prime'

s.add_development_dependency 'rake'
s.add_development_dependency 'sqlite3'
Expand Down
12 changes: 9 additions & 3 deletions gemfiles/rails52.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
PATH
remote: ..
specs:
fast_gettext (2.2.0)
fast_gettext (2.3.0)
prime

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -57,6 +58,7 @@ GEM
erubi (1.10.0)
forking_test_runner (1.6.0)
parallel_tests (>= 1.3.7)
forwardable (1.3.3)
globalid (0.5.2)
activesupport (>= 5.0)
i18n (1.8.10)
Expand All @@ -71,7 +73,7 @@ GEM
mini_mime (1.1.1)
mini_portile2 (2.6.1)
minitest (5.14.4)
nio4r (2.5.8)
nio4r (2.7.3)
nokogiri (1.12.3)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
Expand All @@ -80,6 +82,9 @@ GEM
parallel
parser (3.1.0.0)
ast (~> 2.4.1)
prime (0.1.2)
forwardable
singleton
racc (1.5.2)
rack (2.2.3)
rack-test (1.1.0)
Expand Down Expand Up @@ -140,6 +145,7 @@ GEM
rubocop (>= 0.89, < 2.0)
ruby-progressbar (1.11.0)
single_cov (1.3.2)
singleton (0.2.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -175,4 +181,4 @@ DEPENDENCIES
sqlite3

BUNDLED WITH
2.1.4
2.3.27
16 changes: 3 additions & 13 deletions lib/fast_gettext/vendor/mofile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Changes: Namespaced + uses FastGettext::Icvon

require 'stringio'
require 'prime'

module FastGettext
module GetText
Expand Down Expand Up @@ -167,19 +168,8 @@ def prime?(number)
('1' * number) !~ /^1?$|^(11+?)\1+$/
end

begin
require 'prime'
def next_prime(seed)
Prime.instance.find{|x| x > seed }
end
rescue LoadError
def next_prime(seed)
require 'mathn'
prime = Prime.new
while current = prime.succ
return current if current > seed
end
end
def next_prime(seed)
Prime.instance.find{|x| x > seed }
end

HASHWORDBITS = 32
Expand Down

0 comments on commit abc4bbe

Please sign in to comment.