'require' and 'include' are completely two different concepts.
When you require a ruby file you tell the current file to look for classes
and modules in that file when needed, also any code not wrapped in method
will be executed on require automatically. So you have to 'require' other
file before
On Thu, Mar 12, 2009 at 10:18, wesley chen cjq@gmail.com wrote:
How to print the methods in the class or module out?
Wesley,
you need this?
a =
=
a.methods
= [%, select, []=, inspect, , each_byte, clone, method,
gsub, casecmp, public_methods, to_str, partition, tr_s,
...
capitalize!,
Thanks.
class.instance_methods
module.instance_methods make it.
Thanks.
Wesley Chen.
On Thu, Mar 12, 2009 at 5:32 PM, wesley chen cjq@gmail.com wrote:
Hi, Zeljko,
Sorry, I have not demonstrated clearly enough.
Suppose I have written a module or a class, in the module or class, I have
Hi, Zeljko,
Sorry, I have not demonstrated clearly enough.
Suppose I have written a module or a class, in the module or class, I have
written many methods. I would like to print all my methods out.
How can I make it?
Any suggestion would be appreciated.
Thanks.
Wesley Chen.
On Thu, Mar 12,
On Thu, Mar 12, 2009 at 10:32, wesley chen cjq@gmail.com wrote:
I would like to print all my methods out.
And this is not what you need?
class MyClass
# some code
end
variable = MyClass.new
variable.methods
Željko
--~--~-~--~~~---~--~~
You received this
Brilliant!
On Mar 12, 4:34 am, Željko Filipin zeljko.fili...@wa-research.ch
wrote:
On Thu, Mar 12, 2009 at 10:32, wesley chen cjq@gmail.com wrote:
I would like to print all my methods out.
And this is not what you need?
class MyClass
# some code
end
variable = MyClass.new
On Thu, Mar 12, 2009 at 4:38 AM, wesley chen cjq@gmail.com wrote:
Thanks, :), it is exactly what I want.
I ask this kind of questions because I find, in my code, I use too many:
include module.
When I include the module into the class, all the methods in the module
comes into the
I'm still learning a lot regarding how ruby handles modules, classes
etc..
but in general, woudln't using require instead of include solve his
problem? (unless he's actually extending or subclassing stuff from
the modules)
I thought I remember seeing something about a lot of folks using