class Hashie::Extensions::Parsers::YamlErbParser

Public Class Methods

new(file_path) click to toggle source
# File lib/hashie/extensions/parsers/yaml_erb_parser.rb, line 9
def initialize(file_path)
  @content = File.read(file_path)
  @file_path = file_path.is_a?(Pathname) ? file_path.to_s : file_path
end
perform(file_path) click to toggle source
# File lib/hashie/extensions/parsers/yaml_erb_parser.rb, line 20
def self.perform(file_path)
  new(file_path).perform
end

Public Instance Methods

perform() click to toggle source
# File lib/hashie/extensions/parsers/yaml_erb_parser.rb, line 14
def perform
  template = ERB.new(@content)
  template.filename = @file_path
  YAML.safe_load template.result
end