Sha256: 77a3a1ff928270f5de97220b8d0e427be04993043305c27b06e712c548a76f0f
Contents?: true
Size: 591 Bytes
Versions: 1
Compression:
Stored size: 591 Bytes
Contents
require_relative 'tags' module Signore class SigFinder def self.find(sigs, random: Random.new, tags: Tags.new) new(sigs, random: random).find_tagged(tags: tags) end def initialize(sigs, random: Random.new) @random = random @sigs = sigs end def find_tagged(tags: Tags.new) sigs .select { |sig| tags.required.all? { |tag| sig.tagged_with?(tag) } } .reject { |sig| tags.forbidden.any? { |tag| sig.tagged_with?(tag) } } .sample(random: random) or Signature.new end private_attr_reader :random, :sigs end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
signore-0.3.3 | lib/signore/sig_finder.rb |