[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Loading .rb files in IRb

Gudni Hilmarsson

12/24/2007 12:15:00 PM

Hi..

I am trying to get IRb to load a file. I am running a fresh install of
Mac OS X Leopard and I have updated my gems and RubyGems. Below is the
Class file ( From the Pickaxe and saved under /Users/gudni/Song.rb ) and
the results from my previous attempts.

Attempt 1:
>> load '/Users/gudni/Song.rb'

--> LoadError: no such file to load -- /Users/gudni/Song.rb
from (irb):3:in `load'
from (irb):3

Attempt 2:
>> require '/Users/gudni/Song.rb'

-->LoadError: no such file to load -- /Users/gudni/Song.rb
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
from (irb):5

I can't get it to work. According to the pickaxe it should be enough to
give the full path to the file, but it doesn't seem to work for me. Any
help would be much appreciated :D

P.S. Happy holidays :D

class Song
def initialize(name, artist, duration)
@name = name
@artist = artist
@duration = duration
end

def to_s
"Song: #@name--#@artist (#@duration)"
end
end


Content of my $:

>> puts $:
/Library/Ruby/Gems/1.8/gems/wirble-0.1.2/bin
/Library/Ruby/Gems/1.8/gems/wirble-0.1.2/.
/Library/Ruby/Site/1.8
/Library/Ruby/Site/1.8/powerpc-darwin9.0
/Library/Ruby/Site/1.8/universal-darwin9.0
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin9.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0
3 Answers

F. Senault

12/24/2007 1:04:00 PM

0

Le 24 décembre à 13:14, Gudni Hilmarsson a écrit :

> Attempt 1:
>>> load '/Users/gudni/Song.rb'
>
> --> LoadError: no such file to load -- /Users/gudni/Song.rb
> from (irb):3:in `load'
> from (irb):3

It really should work. Note that path and file names are probably
case-sensitive, though. You can try to use Dir.glob to list the
contents of the directory :

>> Dir.glob('/home/fred/*.rb')
=> ["/home/fred/toto.rb", "/home/fred/main.rb"]

Fred
--
I am standing up at the water's edge in my dream
I cannot make a single sound as you scream
it can't be that cold, the ground is still warm to touch
this place is so quiet, sensing that storm (Peter Gabriel, Red Rain)

Gudni Hilmarsson

12/24/2007 1:37:00 PM

0

Thanks for the Reply Fred...

I figured out that TextMate added a whitespace after .rb !

Dir.glob('/Users/gudni/*')
=> ["/Users/gudni/Desktop", "/Users/gudni/Documents",
"/Users/gudni/Downloads", "/Users/gudni/KaraokeSong.rb ",
"/Users/gudni/Library", "/Users/gudni/Movies", "/Users/gudni/Music",
"/Users/gudni/Pictures", "/Users/gudni/Public", "/Users/gudni/Sites",
"/Users/gudni/Song.rb ", "/Users/gudni/test.rb "]

That is whack :D

Anyway thanks for pointing me in the right direction :D

--
Posted via http://www.ruby-....

Sigmund Freud

2/21/2014 12:10:00 AM

0

On Thursday, February 20, 2014 3:39:43 PM UTC-5, Rhino wrote:
> On 2014-02-19 5:21 PM, Adam H. Kerman wrote:
> > You know, this is getting annoying. Either you're writing a spoiler,
> > or you're not. General description of a series or an episode, or a cast
> > list, or a heads up about the time slot, isn't a spoiler.
> >
> > A spoiler is a revelation of the outcome of major plot developments,
> > characters dying, surprises, any of which would ruin an episode for a
> > viewer if he knew about it before he watches.
> >
> > This stuff isn't difficult.
>
> Difficulty has little to do with it when we have the likes of Seamus
> deliberately spoiling key developments every chance he can get. He hides
> behind the argument that just because it was technically possible for
> everyone to have seen something a few hours before, that everyone
> therefore has done so and that anyone who hasn't actually done so has no
> right to any consideration. This was particularly grievous in his recent
> spoiler about the fate of the Zoe character on House of Cards.
>
> He may have watched the entire second season of House of Cards on Feb 14
> but some of us are consuming it a little more slowly. Simply assuming
> that everyone has seen it the minute he has finished it is vastly
> unrealistic. The spoiler I'm thinking of didn't even mention the show
> title or the word "spoiler" in the subject line so anyone who watched a
> show with a character named Zoe in it might very well have read it
> without realizing that it was a spoiler. I certainly would have stayed
> away from his thread if he had labelled it properly. He's more than
> capable of writing a proper subject line but has demonstrated a complete
> lack of courtesy in all his dealings with this newsgroup. I don't think
> he'd hesitate to spoil ANY show, even weeks or months ahead, if he had
> the necessary insider knowledge. I think he does it because he gets off
> on antagonizing people. Somehow he never tires of his desire to piss
> people off. Mostly, he does this through his sock puppets but when the
> opportunity presents itself, he loves to spoil shows too.
>
> Of course he's not the only one who has dropped spoilers but I think he
> sets the tone. I think his flagrant spoiling is perhaps encouraging
> others to follow suit in a Gresham's Law kind of way. I don't think
> there's any hope of getting Seamus to grow up but I hope you're
> successful in persuading the less juvenile regulars on this newsgroup to
> a little more considerate.

Who is zis "Seamus", Rhino? I haff not seen anyone use zat alias in zis
newsgroup. Perhaps you suffer from ze hallucinations, hmm? Lie on zis
couch and I can try to solff zis problem off yours. Though it will cost
you. My rate, eet ees $300 an hour, but I haff a family to feed, yes?