如何在Ironruby中使用Ruby库

时间:2012-05-23 22:26:16

标签: ruby ironruby

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

1 个答案:

答案 0 :(得分:1)

IronRuby使用igem,您可以使用igem ENV检查宝石的位置,并使用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