Sha256: d11e88be79098acc155a88cd49f54899b3fe3d10f908141101268050206dcd8f

Contents?: true

Size: 916 Bytes

Versions: 5

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true

module AwsCftTools
  module Runbooks
    module Common
      ##
      # Templates - operations on templates in multiple runbooks
      #
      module Templates
        private

        def filtered_templates(set)
          filtered_by_environment(
            filtered_by_role(
              filtered_by_selection(options[:templates], set)
            )
          )
        end

        def filtered_by_role(set)
          set.select { |template| template.role?(options[:role]) }
        end

        def filtered_by_environment(set)
          set.select { |template| template.environment?(options[:environment]) }
        end

        def filtered_by_selection(templates, set)
          if templates && templates.any?
            set.select { |template| templates.include?(template.filename.to_s) }
          else
            set
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aws-cft-tools-0.1.4 lib/aws_cft_tools/runbooks/common/templates.rb
aws-cft-tools-0.1.3 lib/aws_cft_tools/runbooks/common/templates.rb
aws-cft-tools-0.1.2 lib/aws_cft_tools/runbooks/common/templates.rb
aws-cft-tools-0.1.1 lib/aws_cft_tools/runbooks/common/templates.rb
aws-cft-tools-0.1.0 lib/aws_cft_tools/runbooks/common/templates.rb