Class: RubyTerraform::Options::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_terraform/options/definition.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Definition

rubocop:disable Metrics/MethodLength



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ruby_terraform/options/definition.rb', line 23

def initialize(opts)
  raise 'Missing name.' unless opts[:name]

  super(
    name: Name.new(opts[:name]),
    option_type: Types.resolve(opts[:option_type]) || Types::Standard,
    value_type: Values.resolve(opts[:value_type]) || Values::String,
    repeatable: opts[:repeatable] || false,
    separator: opts[:separator],
    placement: opts[:placement],
    extra_keys:
      { singular: [], plural: [] }
        .merge(opts[:extra_keys] || {}),
    override_keys:
      { singular: nil, plural: nil }
        .merge(opts[:override_keys] || {})
  )
end

Instance Method Details

#build(parameters) ⇒ Object



47
48
49
# File 'lib/ruby_terraform/options/definition.rb', line 47

def build(parameters)
  build_singular_options(parameters) + build_plural_options(parameters)
end

#matches?(name) ⇒ Boolean

rubocop:enable Metrics/MethodLength

Returns:

  • (Boolean)


43
44
45
# File 'lib/ruby_terraform/options/definition.rb', line 43

def matches?(name)
  @name == Name.new(name)
end