Sha256: ef3873dd97a847c626b5dafa4e1b6cc41266f6907cf85a04d18273b3b68e7c87

Contents?: true

Size: 750 Bytes

Versions: 7

Compression:

Stored size: 750 Bytes

Contents

require 'conjur-asset-policy'

module Conjur
  module Policy
    module YAML
      class Loader
        class << self
          def load yaml, filename = nil
            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
            handler.result
          end
          
          def load_file filename
            load File.read(filename), filename
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
conjur-asset-policy-0.12.0 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.11.0 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.8.3 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.8.2 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.8.1 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.8.0 lib/conjur/policy/yaml/loader.rb
conjur-asset-policy-0.7.1 lib/conjur/policy/yaml/loader.rb