Sha256: 02813c832a6f0e36e2af633f9e8b7e3d374349dc55726ab4d6e25f86ad2640cd

Contents?: true

Size: 592 Bytes

Versions: 7

Compression:

Stored size: 592 Bytes

Contents

module SafeYAML
  class SyckResolver < Resolver
    QUOTE_STYLES = [:quote1, :quote2].freeze

    NODE_TYPES = {
      Hash   => :map,
      Array  => :seq,
      String => :scalar
    }.freeze

    def initialize
      super()
    end

    def native_resolve(node)
      node.transform
    end

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

    def get_node_tag(node)
      node.type_id
    end

    def get_node_value(node)
      node.value
    end

    def value_is_quoted?(node)
      QUOTE_STYLES.include?(node.instance_variable_get(:@style))
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
safe_yaml-0.8.6 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.5 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.4 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.3 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.2 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.1 lib/safe_yaml/syck_resolver.rb
safe_yaml-0.8.0 lib/safe_yaml/syck_resolver.rb