开发者

How to use a module from the interactive Ruby shell?

开发者 https://www.devze.com 2023-01-17 17:56 出处:网络
Ruby newbie here. I\'m trying to use the Easyjour module ( http://easyjour.rubyforge.org/ ) from irb. After a gem install easyjour this is what I get:

Ruby newbie here. I'm trying to use the Easyjour module ( http://easyjour.rubyforge.org/ ) from irb. After a gem install easyjour this is what I get:

irb(main):002:0> service = Easyjour.serve("files", 'http', 3000)
NameError: uninitialized constant Easyjour

What am I missing here? Do I need to 开发者_运维问答import the module first somehow?


You need to first load the easyjour library, before you can use any code from it:

require 'easyjour'


An alternative to Jorg's approach is to load the module at the command line when starting irb:

irb -r easyjour
0

精彩评论

暂无评论...
验证码 换一张
取 消