Sha256: fedbff5a117e2f2bf101a886369f6629dea1b95967114782468dd7ced27a8c1d

Contents?: true

Size: 1.04 KB

Versions: 265

Compression:

Stored size: 1.04 KB

Contents

module SafeYAML
  class PsychResolver < Resolver
    NODE_TYPES = {
      Psych::Nodes::Document => :root,
      Psych::Nodes::Mapping  => :map,
      Psych::Nodes::Sequence => :seq,
      Psych::Nodes::Scalar   => :scalar,
      Psych::Nodes::Alias    => :alias
    }.freeze

    def initialize(options={})
      super
      @aliased_nodes = {}
    end

    def resolve_root(root)
      resolve_seq(root).first
    end

    def resolve_alias(node)
      resolve_node(@aliased_nodes[node.anchor])
    end

    def native_resolve(node)
      @visitor ||= SafeYAML::SafeToRubyVisitor.new(self)
      @visitor.accept(node)
    end

    def get_node_type(node)
      NODE_TYPES[node.class]
    end

    def get_node_tag(node)
      node.tag
    end

    def get_node_value(node)
      @aliased_nodes[node.anchor] = node if node.respond_to?(:anchor) && node.anchor

      case get_node_type(node)
      when :root, :map, :seq
        node.children
      when :scalar
        node.value
      end
    end

    def value_is_quoted?(node)
      node.quoted
    end
  end
end

Version data entries

265 entries across 243 versions & 17 rubygems

Version Path
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
brakeman-4.7.1 bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
brakeman-4.7.0 bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_resolver.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/psych_resolver.rb