class SafeYAML::TagVerifier
Public Class Methods
new(whitelist)
click to toggle source
# File lib/safe_yaml/tag_verifier.rb, line 5 def initialize(whitelist) @whitelist = whitelist @seen = Set.new end
Public Instance Methods
verify_tag!(tag, value)
click to toggle source
# File lib/safe_yaml/tag_verifier.rb, line 10 def verify_tag!(tag, value) return if !tag || @seen.include?(tag) case @whitelist.check(tag, value) when :cacheable @seen << tag when :allowed # in the whitelist, but can't be cached (because it called a proc for yes/no) else raise SafeYAML::UnsafeTagError.new("YAML tag is not whitelisted: #{tag} #{value.inspect}") end end