Sha256: eb93b1343597cea7774775bdb354e0a9f352662e0cad60c3ee7ecbeb57c23765

Contents?: true

Size: 488 Bytes

Versions: 8

Compression:

Stored size: 488 Bytes

Contents

require 'yaml'
require 'erb'
module Hashie
  module Extensions
    module Parsers
      class YamlErbParser
        def initialize(file_path)
          @content = File.read(file_path)
          @file_path = file_path
        end

        def perform
          template = ERB.new(@content)
          template.filename = @file_path
          YAML.load template.result
        end

        def self.perform(file_path)
          new(file_path).perform
        end
      end
    end
  end
end

Version data entries

8 entries across 7 versions & 2 rubygems

Version Path
hashie-3.4.4 lib/hashie/extensions/parsers/yaml_erb_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/hashie-3.4.3/lib/hashie/extensions/parsers/yaml_erb_parser.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/hashie-3.4.3/lib/hashie/extensions/parsers/yaml_erb_parser.rb
hashie-3.4.3 lib/hashie/extensions/parsers/yaml_erb_parser.rb
hashie-3.4.2 lib/hashie/extensions/parsers/yaml_erb_parser.rb
hashie-3.4.1 lib/hashie/extensions/parsers/yaml_erb_parser.rb
hashie-3.4.0 lib/hashie/extensions/parsers/yaml_erb_parser.rb
hashie-3.3.2 lib/hashie/extensions/parsers/yaml_erb_parser.rb