------art_7947_2159098.1138724344402
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 1/31/06, Edgard Riba <elriba / rimith.com> wrote:
>
> Hi,
> I'm beginning to work with ruby and I have a conceptual problem.   Let's
> say I have two files:
>
> hello2.rb:
>   class Hello2
>     attr_reader :msg
>     def initialize
>         @msg = "Hello, World2"
>     end
>   end
>
> and hello.rb
>
> require 'hello2.rb'
> class Hello
>     attr_reader :msg
>     def initialize
>         @msg = "Hello, World"
>     end
> end
> h = Hello.new()
> h2 = Hello2.new()
> puts h2.msg
> puts h.msg
> print "Press RETURN"
> $stdin.gets
>
> This is obviously a conceptual excercise.    I want to use class
> "Hello2" in my hello.rb code.   However this doesn't compile.
>
> What is wrong with this code?   How is something like this done in Ruby?
> Thansk, Edgard


Drop the .rb from you're require line.  So it should be
require 'hello2'

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


--
===Tanner Burson===
tanner.burson / gmail.com
http://tannerburson.com   <---Might even work one day...

------art_7947_2159098.1138724344402--