file.open(path)' returns this error in the SciTE editor:
"undefined local variable or method `math' for main:Object (NameError)"
That line most certainly does not cause that error. You might want to show the
whole code or if it's a lot of code, the smallest possible example that's
runnable and produces the error.
Yike. I 'knew it' but forgot, not at the surface of my mind/reading. I
had fallen into a misconception, explained by this correct
interpretation of file handing...
begin
ruby> file = open("/tmp/some_file", "w")
ruby> # something to do
ruby> ensure
ruby> file.close
ruby> end
Sebastian Hungerecker wrote:
···
Ed Hardy wrote:
file.open(path)' returns this error in the SciTE editor:
"undefined local variable or method `math' for main:Object (NameError)"
That line most certainly does not cause that error. You might want to
show the
whole code or if it's a lot of code, the smallest possible example
that's
runnable and produces the error.
Let's assume I know nothing. Though I thought I understood this
dilemma, I'm now lost. I've been studying like crazy, bought a book,
and even have even written a program that pumps out html pages with
webrick, but I am still hung up on some basic items.
For instance, this line fails:
puts math.sqrt(234)
it outputs this error:
"undefined local variable or method `math' for main:Object (NameError)"
this line fails:
f= file.open('c:\cher.bat') # similar error message as above
these lines run OK:
f= open('c:\cher.bat')
d= f.read()
puts d
f.close()
I installed 1.8.6 (path level 111) on XP Windows with the one-click
installer.
Same issue - class and module names are capitalised in ruby.
Math.sqrt
File.open
etc
martin
···
On Fri, Nov 7, 2008 at 11:02 AM, Ed Hardy <asm.sol@excite.com> wrote:
Let's assume I know nothing. Though I thought I understood this
dilemma, I'm now lost. I've been studying like crazy, bought a book,
and even have even written a program that pumps out html pages with
webrick, but I am still hung up on some basic items.