Sha256: 262b8590ec7d52eaf3640a17b776c68c742b0f86ada59853e5d666abc7f88950

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

# frozen_string_literal: true

module TFW
  # Dynamically create stack methods
  module CreateStackMethods
    def create_stack_methods
      stack = TFW::State.instance.stack
      %w[provider variable locals tfmodule datasource resource output terraform].each do |name|
        define_method(name) { |*args, &block| stack.method(name).call(*args, &block) }
      end
    end
  end

  # This class carries stack methods, use it through inheritance class SomeClass < StackMethods
  class StackMethods
    extend CreateStackMethods
    create_stack_methods
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tfw-0.1.19 lib/tfw/stack_methods.rb
tfw-0.1.18 lib/tfw/stack_methods.rb
tfw-0.1.17 lib/tfw/stack_methods.rb