Projects

Ticket #286 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

YAML unable to load NSString

Reported by: ndnichols@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.5
Component: MacRuby Keywords:
Cc: ndnichols@…

Description

If you YAML.dump an immutable NSString (like the kind returned by an NSTextfield's -stringValue), you cannot YAML.load it. It fails with a "bind argument must be an instance of NSMutableString (TypeError)" error. You can YAML.dump a mutableCopy.

Attached is an rb_main.rb file that demonstrates this.

Attachments

rb_main.rb Download (0.9 KB) - added by ndnichols@… 3 years ago.
rb_main.rb that demonstrates the issue

Change History

Changed 3 years ago by ndnichols@…

rb_main.rb that demonstrates the issue

Changed 3 years ago by ndnichols@…

  • cc ndnichols@… added

Cc Me!

Changed 2 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.5

It appears to work with trunk (at least as of r2945):

$ macruby -r yaml -e "p NSString.stringWithString('hey').class"
NSString
$ macruby -r yaml -e "p NSString.stringWithString('hey').to_yaml"
"--- hey\n"

#to_yaml on an immutable string returns a valid YAML description.

Note: See TracTickets for help on using tickets.