Sha256: 7634c22c708e44f6b811a95c2123b42dd0d8b68980ba52fe3940e2bf793e2eb1

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

module PsmDeadSimpleDeploymentTools
  module Utils
    # nodoc
    class ErbUtil
      class Error < StandardError; end
      attr_reader :file_path, :ctx_binding

      def initialize(file_path, binding)
        @file_path = file_path
        @ctx_binding = binding
      end

      def result
        raise Error, "template path not found: #{file_path}" unless File.exist?(file_path)

        template_content = File.read(file_path)
        ERB.new(template_content).result(ctx_binding)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
psm_dead_simple_deployment_tools-0.1.1 lib/psm_dead_simple_deployment_tools/utills/erb_util.rb