Sha256: 8b0944f96636857546b780d45f05ce4ffce78a76763a2fb0047b609cdb6f50fb

Contents?: true

Size: 514 Bytes

Versions: 5

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

require_relative '../generator'

module Dagger
  module Generate
    # Set requirement for further processing.
    #
    # _default.key:
    #   - require:
    #       key: regexp
    #   - ...
    class Require < Dagger::Generator
      def process(keys)
        stop unless keys.any? do |key, regexps|
          string = dictionary[key]
          array(regexps).any? do |regexp|
            ::Regexp.new(regexp).match?(string)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-dagger-0.4.0 lib/dagger/generate/require.rb
ruby-dagger-0.3.3 lib/dagger/generate/require.rb
ruby-dagger-0.3.2 lib/dagger/generate/require.rb
ruby-dagger-0.3.1 lib/dagger/generate/require.rb
ruby-dagger-0.3.0 lib/dagger/generate/require.rb