Ruby Black Belt

J

James Edward Gray II

They are actually Kernel *instance* methods.

Robert Dober was kind enough to point out that RDoc may have led me
astray here. You can call Kernel methods like class methods and they
do not show up in the list of instance_methods(). They are mixed
into Object though, right? Can someone clue me in here?

James Edward Gray II

P.S. See how hard it is to get a test right? ;) We now know I'm
not smart enough to write one...
 
T

ts

J> Robert Dober was kind enough to point out that RDoc may have led me
J> astray here. You can call Kernel methods like class methods and they
J> do not show up in the list of instance_methods(). They are mixed
J> into Object though, right? Can someone clue me in here?

a global function is a Kernel module function : this mean that it's a
*private* method (this is why #instance_methods don't display it) and a
public singleton method

moulon% ruby -e 'module M def f() end; module_function :f end; p M.instance_methods'
[]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p M.private_instance_methods'
["f"]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p M.singleton_methods'
["f"]
moulon%


Guy Decoux
 
J

James Britt

Jeppe said:
Yeah I could do that, but this is my first language and I can still only
answer basic questions.

Ah, but that gives you a certain advantage. You can explain to other
newcomers those things that at first seemed odd or confusing.

People who've been using a language for a while tend to forget those things.



--
James Britt

http://web2.0validator.com - We're the Dot in Web 2.0
http://refreshingcities.org - Design, technology, usability
http://yourelevatorpitch.com - Finding Business Focus
http://www.jamesbritt.com - Playing with Better Toys
 
J

James Britt

Dmitry said:
And tell me one more thing - why some of You afraid of Ruby becoming
popular?

Wow, good troll.

:)

Pretty sure no one here ever expressed concern over Ruby's popularity.



--
James Britt

"In physics the truth is rarely perfectly clear, and that is certainly
universally the case in human affairs. Hence, what is not surrounded by
uncertainty cannot be the truth."
- R. Feynman
 
J

James Edward Gray II

J> Robert Dober was kind enough to point out that RDoc may have led me
J> astray here. You can call Kernel methods like class methods and
they
J> do not show up in the list of instance_methods(). They are mixed
J> into Object though, right? Can someone clue me in here?

a global function is a Kernel module function : this mean that it's a
*private* method (this is why #instance_methods don't display it)
and a
public singleton method

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.instance_methods'
[]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.private_instance_methods'
["f"]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.singleton_methods'
["f"]
moulon%

Thanks for the lesson Guy. Insightful as always.

James Edward Gray II
 
J

James Britt

ts said:
J> Robert Dober was kind enough to point out that RDoc may have led me
J> astray here. You can call Kernel methods like class methods and they
J> do not show up in the list of instance_methods(). They are mixed
J> into Object though, right? Can someone clue me in here?

a global function is a Kernel module function : this mean that it's a
*private* method (this is why #instance_methods don't display it) and a
public singleton method

moulon% ruby -e 'module M def f() end; module_function :f end; p M.instance_methods'
[]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p M.private_instance_methods'
["f"]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p M.singleton_methods'
["f"]
moulon%


http://www.ruby-doc.org/core/classes/Module.html#M000725
 
R

Robert Dober

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

J> Robert Dober was kind enough to point out that RDoc may have led me
J> astray here. You can call Kernel methods like class methods and they
J> do not show up in the list of instance_methods(). They are mixed
J> into Object though, right? Can someone clue me in here?

a global function is a Kernel module function : this mean that it's a
*private* method (this is why #instance_methods don't display it) and a
public singleton method

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.instance_methods'
[]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.private_instance_methods'
["f"]
moulon%

moulon% ruby -e 'module M def f() end; module_function :f end; p
M.singleton_methods'
["f"]
moulon%


Guy Decoux



I knew I was wrong all the time, ty for showing me

here we go ;)
irb(main):015:0> Kernel.private_instance_methods
=3D> ["gets", "catch", "String", "`", "sleep", "getc", "warn", "gsub!",
"iterator?", "sprintf", "remove_instance_variable", "Integer", "split",
"putc", "abort", "chop", "lambda", "initialize_copy", "srand", "p",
"local_variables", "singleton_method_removed", "printf", "caller",
"require", "sub", "eval", "set_trace_func", "callcc", "binding", "readline"=
,
"throw", "Array", "chop!", "syscall", "raise", "autoload?", "format",
"trace_var", "exit!", "block_given?", "trap", "Float", "at_exit", "puts",
"loop", "sub!", "chomp", "system", "singleton_method_undefined",
"method_missing", "scan", "select", "rand", "exit", "print", "fork", "gsub"=
,
"exec", "autoload", "singleton_method_added", "global_variables",
"readlines", "proc", "fail", "chomp!", "open", "untrace_var", "test",
"load"]

irb(main):016:0> Kernel.private_instance_methods.include?("puts")
=3D> true

Cheers
Robert






--
Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein

------=_Part_901_5991014.1143646844489--
 
P

paul.denlinger

I am learning Ruby as my first language, and have spent about one week
on it so far. So far, I like the language a lot.

Right now, I'm working my way through Pick-axe, and some other books to
learn about the syntax and features of the language. In my case, having
some kind of quiz/test would be helpful, as it would force me to test
my knowledge, and would make me aware of holes in my Ruby knowledge
which I would need to address. I like the idea of working up to
different levels mentioned in Peter's posting about Python, and can see
how it would be helpful to a lot of new fans of Ruby.

I can understand how some people are worried about the word
certification, fearing that it would create some kind of hierarchy of
insiders, with everyone else being outsiders. Maybe this is because of
the nature of the word "certification".

However, if we can have exams/quizzes or whatever else you want to call
them to help newbies like me to learn Ruby, that would be a really
welcome move.

Paul
 
D

dblack

Hi --

I can understand how some people are worried about the word
certification, fearing that it would create some kind of hierarchy of
insiders, with everyone else being outsiders. Maybe this is because of
the nature of the word "certification".

I share that fear. I'd hate to see people brand themselves as
outsiders by getting Ruby "certification" :)


David

--
David A. Black ([email protected])
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black
 
B

Bill Kelly

From: "Peter Szinek said:
http://www.pythonchallenge.com/

I also solved the python challege up to level 20 or something when it
got too time consuming. To sum it up: to get to the next level you
needed to apply some python technique/module (like regexps, loading a
web page, IO, gfx, GUI, etc) and it was gradually getting harder and
harder. The catch was, that even the non-programmers rushed to learn to
program - because there was no other way around to get to the next level
and because you wanted to get to the next level badly (it was kinda
addictive). When the next level came up, it was immediately clear that
you are missing info on this or that technique/module/feature of the
language.

I know that the ruby-quiz is around, and i think it is a great idea - i
hope i will manage to find some time to play around with it. However,
what was different in the case of the python challenge: it was
hierarchical, and in a very natural yet funny way it somehow certified
your skills in python/programming (i.e. if you got yourself to level X,
you had some experience with regexps, IO, web, UI, ...). I think this is
the kind of certificate which would be interesting to see in Ruby as
well - and not the Java style experience-with-obscurity-is-knowledge
style crap.

Interesting. I was looking for an interactive Python
interpreter on the web page. I did the first couple using
IRB. I did like the humor... ("Have you ever heard of jvon
files??")

For Ruby, have you seen http://tryruby.hobix.com/ ?

I think tryruby is awesome. I've given the link to people who
were interested in ruby but not only had never tried it, they
had very little programming experience. The feedback has been
positive (apart from the session timing out when they took a
short break. :)

Anyway, so the python challenge got me wondering what an
advanced-skill version of tryruby would be like . . . .


Regards,

Bill
 
G

Gregory Brown

And tell me one more thing - why some of You afraid of Ruby becoming
popular?

I'm not afraid of it becoming popular in general. Am I afraid of it
becoming popular like Walmart? You bet ya. I don't want ruby to be
low prices always.... at the expense of it's community. To the extent
that it gets popular, I should hope that it does so on it's own merit,
which it is already doing.

Ruby can be appreciated and competent rubyists can be found without
some sort of organization telling me what a good Rubyist is or what I
should know to be considered competent.
 
P

paul.denlinger

I just played with the Try Ruby site for 15 minutes, and like it very
much. For new programmers, it's an excellent combination with the
Pick-axe book. I'm sure that a version for more advanced programmers
would be very welcome, and would help in the propagation of Ruby.

A RubyOnRails version of the online tutorial would be really neat!

Can you imagine building your own web app with an online tutorial...

Paul
 
J

James Britt

Alex said:
I think the community could come up with something better and more interesting
than an online test but I do not think that "something" should be
rubyquiz.com, sorry James.

rubyquiz.com is a really great source for gaining practical knowledge
if you already know
enough about programming and ruby in order to participate.

The problem with rubyquiz is that there is no continuity, it starts off at
a very high level, newbies have to search around looking for a simple starting
exercise, probably picking the wrong one, getting frustrated, giving
up, and then I look
for a new exercise to try.. and I get frustrated again ..err.. I mean
"newbies" get
frustrated again.. ahem.. anyway..

rubyquiz also isnt very "fun" in itself ..oh sure, if you find the act
of programming itself
to be "fun" then ruby quiz is lots of fun, but then so is every other
act of programming.
...


*Fewf* sorry for all the oral spew..
James dont take this as criticism for rubyquiz, I love what you're
doing for the community over there.
I just dont think that its the "next step" to learning ruby that many
claim it to be.


If you (or anyone else) are as passionate about this as your post
suggests, then I encourage you to just go and do it. Make a site,
however simple, just get it going, invite people to join in, and see
where it goes.

People can go round and round arguing the merits of something, but a
working site trumps speculation.



--
James Britt

"Programs must be written for people to read, and only incidentally
for machines to execute."
- H. Abelson and G. Sussman
(in "The Structure and Interpretation of Computer Programs)
 
R

Ross Bamford

I really join those who think certification is a bad idea!
And even if it were a good idea, which I doubt, do you think a certification
could really mean you know what you are doing?
Nahh, look at all that certificates one can get (buy?). Cisco, RedHat, Java,
Micros**t, you name it, it is all about Business and
few about Knowledge.

+1 ... couldn't have said it better myself.
 
A

Alex Combas

T24gMy8yOS8wNiwgSmFtZXMgQnJpdHQgPGphbWVzX2JAbmV1cm9nYW1pLmNvbT4gd3JvdGU6Cj4g
SWYgeW91IChvciBhbnlvbmUgZWxzZSkgYXJlIGFzIHBhc3Npb25hdGUgYWJvdXQgdGhpcyBhcyB5
b3VyIHBvc3QKPiBzdWdnZXN0cywgdGhlbiBJIGVuY291cmFnZSB5b3UgdG8ganVzdCBnbyBhbmQg
ZG8gaXQuICBNYWtlIGEgc2l0ZSwKPiBob3dldmVyIHNpbXBsZSwganVzdCBnZXQgaXQgZ29pbmcs
IGludml0ZSBwZW9wbGUgdG8gam9pbiBpbiwgYW5kIHNlZQo+IHdoZXJlIGl0IGdvZXMuCj4KPiBQ
ZW9wbGUgY2FuIGdvIHJvdW5kIGFuZCByb3VuZCBhcmd1aW5nIHRoZSBtZXJpdHMgb2Ygc29tZXRo
aW5nLCBidXQgYQo+IHdvcmtpbmcgc2l0ZSB0cnVtcHMgc3BlY3VsYXRpb24uCj4KCkkgdGhpbmtz
IHRoYXRzIGEgZ3JlYXQgaWRlYSBKYW1lcywgSSdtIGdvaW5nIHRvIGFkZCB0aGlzIHRvIG15IGxp
c3Qgb2YgY3VycmVudApwcm9qZWN0cywgSSdsbCBwb3N0IGJhY2sgdG8gdGhlIGxpc3Qgd2hlbiBJ
IGhhdmUgc29tZXRoaW5nIHN0YXJ0ZWQKdGhhdCBwZW9wbGUgY2FuIGpvaW4gYW5kIGhlbHAgd2l0
aCBpZiB0aGV5IGFyZSBpbnRlcmVzdGVkLCBnaXZlIGl0IGFib3V0IGEgd2Vlay4KCgotLQpBbGV4
IENvbWJhcwpodHRwOi8vbm9vZGxlanVua2llLmNvbS8K
 
M

Michael Trier

To suggest that there's nothing between the pickaxe and rubyquiz is
ridiculous. There's plenty of opportunities. As others have said,
this list is an excellent way to learn, first by reading and
understanding, but then as James said, by contributing.

I find teaching (contributing) to be the best vehicle for learning.=20
It forces you to really fill in the gaps in your own understanding as
you work through it. Plus, if there are still gaps, others will
kindly point those out as well. :)

In addition, there's such things as IRC, RubyConf, RailsConf, Rails
Studio, etc.. etc..

Michael
 
S

Steven Lumos

James Edward Gray II said:
Do You want to take part in the creation process of exam series,
covering Ruby itself and RoR framework?

Not really, but I doubt you want to hear that. ;) So, I better at
least point some things out. From your basic exam:
[...]
Ruby Environment (1 question)
Know that RUBYPATH contains a list of directories to look for
included files.

This variable is not set on my system, just FYI.

And that's not what RUBYPATH does. That's what RUBYLIB does.

[...]
This is not related to modules.


Again, nothing to do with modules.

And furthermore:

[/tmp/slumos]0% touch blah.rb
[/tmp/slumos]0% irb
irb(main):001:0> require 'blah'
=> true
irb(main):002:0> load 'blah'
LoadError: no such file to load -- blah
from (irb):2:in `load'
from (irb):2
irb(main):003:0> load 'blah.rb'
=> true
Again.

James Edward Gray II

Steve
 
M

Michael Trier

Alex, obviously you have different opinions / experiences about what
are effective and non-effective means for learning, and that's good,
because everyone approaches these things differently. I can only
speak from my own experiences.

The reason I find the lists a good learning method is because,
although there is a flood of postings they run the gamut. There are
very beginner type questions and then there are questions / comments
about stuff that I have no way of even following. The advantage is
it's an "iron sharpens iron" type of environment. I only have to pay
attention to those things that are in my sphere of understanding at
any given moment. Often seeing the different approaches / answers
works in a mentoring kind of way. For me that's beneficial.

Hopefully you can codify that which you think would be beneficial for
those people in that "in-between" stage and provide an effective
platform for them. I really think that has merit. Good luck.

Michael
 
L

listrecv

One of the problems I'd have with a certification of this sort is that
it focuses only on the least important aspects of the language -
syntax, nomenclature, conventions, etc.

What's really important is good design skills, especially using Ruby's
tools (OO, metaprogramming, agility, etc.). And these are the type of
things which are almost impossible to test on a curicullum based,
multiple choice, certification.

Knowing a language means little more than knowing a bunch of syntax.
It's a world apart from knowing how to develop. Right now, there are
only two languages where it's usually safe to assume that someone who
knows "language" is also a good developer (Ruby and Python) - I'd hate
to see Ruby fall from that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,066
Members
47,673
Latest member
MahaliaPal

Latest Threads

Top