Class: Complex
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.yaml_new(klass, tag, val) ⇒ Object
420 421 422 423 424 425 426 |
# File 'lib/syck/rubytypes.rb', line 420 def Complex.yaml_new( klass, tag, val ) if val.is_a? String Complex( val ) else Complex( val['real'], val['image'] ) end end |
Instance Method Details
#to_yaml(opts = {}) ⇒ Object
427 428 429 430 431 432 433 434 435 |
# File 'lib/syck/rubytypes.rb', line 427 def to_yaml( opts = {} ) return super unless YAML == Syck Syck::quick_emit( self, opts ) do |out| out.map( taguri, nil ) do |map| map.add( 'image', imaginary ) map.add( 'real', real ) end end end |