Sha256: b88ee6bda7fd8fe7ff6f930097c40f82c683db2627c5fc31133b4f94f2ea68f2

Contents?: true

Size: 555 Bytes

Versions: 13

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

require_relative 'name'

module RubyGitCrypt
  module Options
    class Factory
      def initialize(definitions)
        @definitions = definitions
      end

      def resolve(names, parameters)
        names
          .map { |name| Name.new(name) }
          .inject([]) do |options, name|
            options + resolve_name(name, parameters)
          end
      end

      private

      def resolve_name(name, parameters)
        @definitions.find { |d| d.matches?(name) }.build(parameters)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ruby_git_crypt-0.2.0.pre.2 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.2.0.pre.1 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.10 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.9 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.8 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.7 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.6 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.5 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.4 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.3 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.2 lib/ruby_git_crypt/options/factory.rb
ruby_git_crypt-0.1.0.pre.1 lib/ruby_git_crypt/options/factory.rb