Exposing Ancestor Public Methods/ Book Reccomendation

Hello,

I am trying to access some attr_accessor and public/protected methods
from
an inheriting class or module.

class Foo:
def initialize(); end
def some_method():
print “Foo are you?\n”
end
end

class Bar < Foo
class << self; end
def initialize(); end
def another_method()
print “Bar am I”
end
end

If I do a Foo.public_methods, it will list some_method as one of those
methods. I am trying to get Bar.public_method to also list that
inherited
method.Is this possible?
Is there also a way to force this inheritance with instance variables?
Likewise I would like to do perform the same activities on modules, and
is
that possible (example below of how I am doing this)?

module Foo:
def some_method():
print “Foo are you?\n”
end
end

class Bar < Foo
class << self; end
def initialize(); end
def another_method()
print “Bar am I”
end
end

Also, is there book that speaks about the core aspects of Ruby
programming,
giving detailed Networking, thread programming, etc. Basically, I am
looking for a general reference book that covers a wide range of areas
in
Ruby programming, which are accompanied by examples. Additionally, the
topics do not need to cover Ruby on Rails. Thanks.

On Mon, Mar 17, 2008 at 10:11 AM, Demonic S.
[email protected] wrote:

Also, is there book that speaks about the core aspects of Ruby programming,
giving detailed Networking, thread programming, etc. Basically, I am
looking for a general reference book that covers a wide range of areas in
Ruby programming, which are accompanied by examples. Additionally, the
topics do not need to cover Ruby on Rails. Thanks.

You need “The Ruby Way”, Second Edition, by Hal F…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs