Sha256: 4075f8d16339fb534f9e0150c804fe34e6358089701bea1bad8641127dbbaf5d
Contents?: true
Size: 524 Bytes
Versions: 17
Compression:
Stored size: 524 Bytes
Contents
require 'mustache' require 'yaml' module Shipitron class MustacheYamlParser def initialize(context:nil, view:nil) if (context.nil? && view.nil?) || (!context.nil? && !view.nil?) raise ArgumentError, 'Either context or view required' end @context = context @view = view @view ||= Mustache end def perform(file_path) file_path = file_path.is_a?(Pathname) ? file_path.to_s : file_path YAML.load(@view.render(File.read(file_path), @context)) end end end
Version data entries
17 entries across 17 versions & 1 rubygems