Class: YAML::SpecialHash

Inherits:
Hash show all
Defined in:
lib/yaml/types.rb

Overview

YAML Hash class to support comments and defaults

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Hash

#yaml_initialize

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



64
65
66
# File 'lib/yaml/types.rb', line 64

def default
  @default
end

Instance Method Details

#inspectObject



65
66
67
# File 'lib/yaml/types.rb', line 65

def inspect
    self.default.to_s
end

#to_sObject



68
69
70
# File 'lib/yaml/types.rb', line 68

def to_s
    self.default.to_s
end

#to_yaml(opts = {}) ⇒ Object



77
78
79
80
# File 'lib/yaml/types.rb', line 77

def to_yaml( opts = {} )
    opts[:DefaultKey] = self.default
    super( opts )
end

#update(h) ⇒ Object



71
72
73
74
75
76
# File 'lib/yaml/types.rb', line 71

def update( h )
    if YAML::SpecialHash === h
        @default = h.default if h.default
    end
    super( h )
end