Class: SafeYAML::PsychTagVerifier

Inherits:
Psych::Handler
  • Object
show all
Defined in:
lib/safe_yaml/psych_tag_verifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(whitelist) ⇒ PsychTagVerifier

Returns a new instance of PsychTagVerifier.



5
6
7
8
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 5

def initialize(whitelist)
  @tags = Set.new
  @verifier = SafeYAML::TagVerifier.new(whitelist)
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



3
4
5
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 3

def tags
  @tags
end

Instance Method Details

#alias(anchor) ⇒ Object



14
15
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 14

def alias(anchor)
end

#end_mappingObject



28
29
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 28

def end_mapping
end

#end_sequenceObject



35
36
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 35

def end_sequence
end

#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object



17
18
19
20
21
22
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 17

def scalar(value, anchor, tag, plain, quoted, style)
  if !quoted && value.is_a?(String)
    YAML.check_string_for_symbol!(value)
  end
  @verifier.verify_tag!(tag, value)
end

#start_mapping(anchor, tag, implicit, style) ⇒ Object



24
25
26
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 24

def start_mapping(anchor, tag, implicit, style)
  @verifier.verify_tag!(tag, nil)
end

#start_sequence(anchor, tag, implicit, style) ⇒ Object



31
32
33
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 31

def start_sequence(anchor, tag, implicit, style)
  @verifier.verify_tag!(tag, nil)
end

#streaming?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 10

def streaming?
  false
end