Sha256: 67dec1353998a41ec66c0356cb4441f472b27ea98de0430f96e44a962de338aa

Contents?: true

Size: 400 Bytes

Versions: 2

Compression:

Stored size: 400 Bytes

Contents

# frozen_string_literal: true

require_relative 'signature'
require_relative 'tags'

module Signore
  class SigFinder
    def initialize(random: Random.new)
      @random = random
    end

    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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
signore-0.6.0 lib/signore/sig_finder.rb
signore-0.5.0 lib/signore/sig_finder.rb