Class: SafeYAML::PsychTagVerifier
- Inherits:
-
Psych::Handler
- Object
- Psych::Handler
- SafeYAML::PsychTagVerifier
- Defined in:
- lib/safe_yaml/psych_tag_verifier.rb
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #alias(anchor) ⇒ Object
- #end_mapping ⇒ Object
- #end_sequence ⇒ Object
-
#initialize(whitelist) ⇒ PsychTagVerifier
constructor
A new instance of PsychTagVerifier.
- #scalar(value, anchor, tag, plain, quoted, style) ⇒ Object
- #start_mapping(anchor, tag, implicit, style) ⇒ Object
- #start_sequence(anchor, tag, implicit, style) ⇒ Object
- #streaming? ⇒ Boolean
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) = Set.new @verifier = SafeYAML::TagVerifier.new(whitelist) end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 3 def end |
Instance Method Details
#alias(anchor) ⇒ Object
14 15 |
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 14 def alias(anchor) end |
#end_mapping ⇒ Object
28 29 |
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 28 def end_mapping end |
#end_sequence ⇒ Object
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
10 11 12 |
# File 'lib/safe_yaml/psych_tag_verifier.rb', line 10 def streaming? false end |