D
David Just
Hello,
I'm trying to learn ruby from the Poignant guide to Ruby
(http://poignantguide.net/ruby/chapter-4.html) and have run into a
problem. In chapter 4 the simple word replacement example is the
first use of the require statement. It does not work for me. I'm on
OS 10.3, ruby 1.8.2 and my directory structure is :
~/projects/test.rb
~/projects/wordlist.rb
test.rb starts with:
require 'wordlist'
and wordlist.rb just has:
words = {
'starmonkeys' => 'Phil and Pete, those prickly chancellors of the
New Reich',
'catapult' => 'chucky go-go', 'firebomb' => 'Heat-Assisted Living',
'Nigeria' => "Ny and Jerry's Dry Cleaning (with Donuts)",
'Put the kabosh on' => 'Put the cable box on'
}
When i try and run test.rb it says that words is an undefined variable.
If i put the definition of words directly into the test.rb file it
works just fine.
I'm really frustrated with this so i could really use some advice.
I've tried all the permutations of require "wordlist", require
"wordlist.rb" require 'wordlist.rb' require "./wordlist.rb" and
nothing works. I can't get much farther until i figure out how to get
require working.
Thanks,
Dave.
I'm trying to learn ruby from the Poignant guide to Ruby
(http://poignantguide.net/ruby/chapter-4.html) and have run into a
problem. In chapter 4 the simple word replacement example is the
first use of the require statement. It does not work for me. I'm on
OS 10.3, ruby 1.8.2 and my directory structure is :
~/projects/test.rb
~/projects/wordlist.rb
test.rb starts with:
require 'wordlist'
and wordlist.rb just has:
words = {
'starmonkeys' => 'Phil and Pete, those prickly chancellors of the
New Reich',
'catapult' => 'chucky go-go', 'firebomb' => 'Heat-Assisted Living',
'Nigeria' => "Ny and Jerry's Dry Cleaning (with Donuts)",
'Put the kabosh on' => 'Put the cable box on'
}
When i try and run test.rb it says that words is an undefined variable.
If i put the definition of words directly into the test.rb file it
works just fine.
I'm really frustrated with this so i could really use some advice.
I've tried all the permutations of require "wordlist", require
"wordlist.rb" require 'wordlist.rb' require "./wordlist.rb" and
nothing works. I can't get much farther until i figure out how to get
require working.
Thanks,
Dave.