Search code examples
yamlironruby

missing method "to_yaml" in IronRuby


I created my own ruby console using IronRuby engine, but I can't get to_yaml to work on any of my .net classes.

Did I missed anything?

person = Person.new
person.Name = 'John Doe'
person.Age = 26
puts person.to_yaml #does not work

Solution

  • It looks like YAML isn't included by default at startup. Try running

    require 'yaml'
    

    first - it made your code work for me in iirb.