Sha256: 1f801b6dcc134030a91158ec6c14b6caf53994c44a37bc3f84451d624759b5d5

Contents?: true

Size: 556 Bytes

Versions: 73

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

require_relative 'name'

module RubyTerraform
  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

73 entries across 73 versions & 1 rubygems

Version Path
ruby-terraform-1.9.0.pre.2 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.9.0.pre.1 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.13 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.12 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.11 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.10 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.9 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.8 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.7 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.6 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.5 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.4 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.3 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.2 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.8.0.pre.1 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.7.0 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.7.0.pre.19 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.7.0.pre.18 lib/ruby_terraform/options/factory.rb
ruby-terraform-1.7.0.pre.17 lib/ruby_terraform/options/factory.rb