Using ice_cube Ruby gem in IRB
Asked Answered
B

3

6

I'm trying to use a Ruby gem called ice_cube in IRB, but it doesn't work:

[~]$ rvm gemset create ice
'ice' gemset created (/home/joe/.rvm/gems/ruby-1.9.2-p320@ice).

[~]$ rvm gemset use ice
Using ruby-1.9.2-p320 with gemset ice

[~]$ gem install ice_cube
Fetching: ice_cube-0.8.0.gem (100%)
Successfully installed ice_cube-0.8.0
1 gem installed
Installing ri documentation for ice_cube-0.8.0...
Installing RDoc documentation for ice_cube-0.8.0...

[~]$ irb --simple-prompt
>> require 'ice_cube'
=> true

>> schedule = Schedule.new(Time.now)
NameError: uninitialized constant Object::Schedule
    from (irb):2
    from /home/joe/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'

What am I doing wrong? (I'm a beginner Ruby programmer.)

Beckybecloud answered 17/7, 2012 at 19:0 Comment(0)
B
15

It should be:

schedule = IceCube::Schedule.new(Time.now)
Beckybecloud answered 17/7, 2012 at 19:14 Comment(3)
Much of the documentation for the gem doesn't make this clear.Beckybecloud
Agreed. Pretty glaring oversightFina
See below... it is mentioned in the documentation.Schwartz
C
3
include IceCube
schedule = Schedule.new(Time.now)

Or you can first include the module into global namespace, then you can use whatever it is in that module.

Crummy answered 4/8, 2013 at 4:24 Comment(0)
C
0

Had similar issue, Try Restarting your Rails Application.

Cytotaxonomy answered 23/7, 2014 at 6:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.