Sha256: 545e2a367cb09ed2ccab7f20b9a6961921c894d689323da7edbc8049a942298c

Contents?: true

Size: 519 Bytes

Versions: 2

Compression:

Stored size: 519 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]
          enumerable(regexps).any? do |regexp|
            ::Regexp.new(regexp).match?(string)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-dagger-0.2.1 lib/dagger/generator/require.rb
ruby-dagger-0.2.0 lib/dagger/generator/require.rb