【问题标题】:missing method "to_yaml" in IronRubyIronRuby 中缺少方法“to_yaml”
【发布时间】:2011-01-13 08:22:13
【问题描述】:

我使用 IronRuby 引擎创建了自己的 ruby​​ 控制台,但我无法让 to_yaml 处理我的任何 .net 类。

我错过了什么吗?

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

【问题讨论】:

    标签: yaml ironruby


    【解决方案1】:

    看起来 YAML 在启动时默认不包括在内。尝试运行

    require 'yaml'
    

    首先 - 它使您的代码在 iirb 中为我工作。

    【讨论】:

    • 谢谢,现在我需要告诉我的应用程序将其指向现有的 ruby​​ 目录 :) 但这已经是一个单独的问题 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    • 1970-01-01
    • 1970-01-01
    • 2021-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多