lib/signore/sig_finder.rb in signore-0.4.2 vs lib/signore/sig_finder.rb in signore-0.5.0
- old
+ new
@@ -1,13 +1,21 @@
+# frozen_string_literal: true
+
require_relative 'signature'
require_relative 'tags'
module Signore
- module SigFinder
- module_function
+ class SigFinder
+ def initialize(random: Random.new)
+ @random = random
+ end
- def find(sigs, random: Random.new, tags: Tags.new)
+ def find(sigs, tags: Tags.new)
shuffled = sigs.shuffle(random: random)
shuffled.find(-> { Signature.new }) { |sig| tags.match?(sig.tags) }
end
+
+ private
+
+ attr_reader :random
end
end