Sha256: 63fbbd7b45282559b8c13301539b6e97f785b19b7634a441e54ec3817be4acef
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
class Object # Dear Ruby, I wish instance variables order was stable, because if it was # then YAML would always come out the same. def to_yaml_properties instance_variables.sort end end module Conjur module Policy module YAML class Loader class << self def load yaml, filename = nil dirname = if filename File.dirname(filename) else '.' end parser = Psych::Parser.new(handler = Handler.new) handler.filename = filename handler.parser = parser begin parser.parse(yaml) rescue handler.log { $!.message } handler.log { $!.backtrace.join(" \n") } raise Invalid.new($!.message || "(no message)", filename, parser.mark) end records = handler.result parse_includes records, dirname records end def load_file filename load File.read(filename), filename end protected def parse_includes records, dirname records.each_with_index do |record, idx| if record.is_a?(Array) parse_includes record, dirname elsif record.is_a?(Types::Policy) parse_includes record.body, dirname elsif record.is_a?(Types::Include) included = load File.read(File.expand_path(record.file, dirname)), record.file records[idx..idx] = included end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
conjur-policy-parser-0.12.0 | lib/conjur/policy/yaml/loader.rb |