Class: Symbol

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_new(klass, tag, val) ⇒ Object



192
193
194
195
196
197
198
199
# File 'lib/syck/rubytypes.rb', line 192

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



200
201
202
203
204
205
# File 'lib/syck/rubytypes.rb', line 200

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