2

我想在 Ironruby 中使用传统的 Ruby 库(1.8.6)。我有问题。例如,“require 'thread'”似乎不适用于 Ironruby 脚本。我需要将 ruby​​ 库放在 Ironruby lib 文件夹中吗?

4

1 回答 1

1

IronRuby 使用 igem,您可以使用 igem ENV 检查 gems 的位置,并使用 igem install 安装缺少的宝石。

    C:\devkit\home\demo>igem ENV
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mswin32]
  - INSTALLATION DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.
9.1
  - RUBY EXECUTABLE: "C:/Program Files (x86)/IronRuby 1.1/bin/ir.exe"
  - EXECUTABLE DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-dotnet-4.0
  - GEM PATHS:
     - C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.9.1
     - C:/Users/Ronda/.gem/ironruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

C:\devkit\home\demo>ir
IronRuby 1.1.3.0 on .NET 4.0.30319.239
Copyright (c) Microsoft Corporation. All rights reserved.

>>> require 'thread'
=> true
于 2012-05-25T19:06:09.733 回答