Hash (Class)

In: yaml/rubytypes.rb
Parent: Object

Maps: Hash#to_yaml

Methods

Public Instance methods

[Source]

# File yaml/rubytypes.rb, line 43
    def is_complex_yaml?
        true
    end

[Source]

# File yaml/rubytypes.rb, line 53
        def to_yaml( opts = {} )
                opts[:DocType] = self.class if Hash === opts
                YAML::quick_emit( self.object_id, opts ) { |out|
            hash_type = to_yaml_type
            if not out.options(:ExplicitTypes) and hash_type == "!map"
                hash_type = ""
            end
            out.map( hash_type ) { |map|
                                #

                                # Sort the hash

                                #

                if out.options(:SortKeys)
                                    map.concat( self.sort )
                else
                    map.concat( self.to_a )
                end
            }
                }
        end

[Source]

# File yaml/rubytypes.rb, line 46
    def to_yaml_type
        if self.class == Hash or self.class == YAML::SpecialHash
            "!map"
        else
            "!ruby/hash:#{self.class}"
        end
    end

[Validate]