Re: Beginner question on classes on different files



Edgard Riba wrote:
> Hi Stefan,
>
> I'm using FreeRuby, and I'm getting intermitent errors.
>
> This is the error I get
>>ruby c:/ruby/samples/hello.rb
> c:/ruby/samples/hello.rb:11: parse error, unexpected tIDENTIFIER,
> expecting $
> h2 = Hello2.new()^Mputs h2.msg^M
> ^

This looks like UNIX-style linebreaks (\n)
that Windows does not interpret correctly.

> However, I placed semi-colons (';') after each line and everything
> compiled fine and ran with expected results:
>
> h = Hello.new();
> h2 = Hello2.new();
>
> puts h2.msg;
> puts h.msg;
> print "Press RETURN";
> $stdin.gets;
>
>
> Seems like some kind of problem with the parser. Maybe I have
> something setup wrong with respect to the end of line character or
> something like that...

There may be a setting in your editor that toggles
the linebreak mode. I actually do not recall this
having been a problem but it has been a while since
I did any ruby development on Windows.

> Thanks,
> Edgard


E

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


.