Class: Symbol

Inherits:
Object show all
Defined in:
lib/yaml/rubytypes.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_new(klass, tag, val) ⇒ Object



184
185
186
187
188
189
190
191
# File 'lib/yaml/rubytypes.rb', line 184

def Symbol.yaml_new( klass, tag, val )
    if String === val
        val = YAML::load( val ) if val =~ /\A(["']).*\1\z/
        val.intern
    else
        raise YAML::TypeError, "Invalid Symbol: " + val.inspect
    end
end

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



192
193
194
195
196
# File 'lib/yaml/rubytypes.rb', line 192

def to_yaml( opts = {} )
	YAML::quick_emit( nil, opts ) do |out|
           out.scalar( "tag:yaml.org,2002:str", self.inspect, :plain )
       end
end