–
Feb 12 Abraham Lincoln born, 1809
Feb 12 Charles Darwin born in Shrewsbury, England, 1809
Feb 12 Lincoln’s real birthday
Feb 12 Santa Barbara oil leak, 1969
Feb 12 Pyidaungsa Day in Burma
Feb 12 The Beatles play Carnegie Hall in New York City, 1964
Feb 12* Rosh Chodesh Adar (Beginning of the month of Adar)
batsman@tux-chan:~/src/cvs/ruby$ irb
irb(main):001:0> def bla
irb(main):002:1> end
=> nil
irb(main):003:0> p respond_to? “bla”
true
=> nil
irb(main):004:0>
batsman@tux-chan:~/src/cvs/ruby$ irb1.7
irb(main):001:0> def bla
irb(main):002:1> end
nil
irb(main):003:0> p respond_to? “bla”
(irb):3: warning: parenthesize argument(s) for future version
false
nil
irb(main):004:0> p respond_to? “bla”, true
(irb):4: warning: parenthesize argument(s) for future version
true
nil
irb(main):005:0> p respond_to?(“bla”, true)
true
nil
···
On Thu, Feb 13, 2003 at 05:48:04PM +0900, Kent Dahl wrote:
Daniel Bretoi wrote:
<%
def blah
end
p respond_to? “blah”
%>
==> false
anyone know why? And how to get around?
$ irb
irb(main):001:0> def blah
irb(main):002:1> end
nil
irb(main):003:0> p respond_to? “blah”
false
nil
Doesn’t look to me like mod_ruby is part of the problem equation
atleast.
irb(main):001:0> def blah
irb(main):002:1> end
=> nil
irb(main):003:0> p respond_to? “blah”
true
=> nil
After doing a p private_methods, every single method in my
mod_ruby scripts show up as private, even though non have been declared
as such. Is this a safety feature of mod_ruby?
db
···
On Thu, Feb 13, 2003 at 05:48:04PM +0900, Kent Dahl wrote:
Daniel Bretoi wrote:
<%
def blah
end
p respond_to? “blah”
%>
==> false
anyone know why? And how to get around?
$ irb
irb(main):001:0> def blah
irb(main):002:1> end
nil
irb(main):003:0> p respond_to? “blah”
false
nil
Doesn’t look to me like mod_ruby is part of the problem equation
atleast.
irb(main):001:0> def blah
irb(main):002:1> end
=> nil
irb(main):003:0> p respond_to? “blah”
true
=> nil
After doing a p private_methods, every single method in my
mod_ruby scripts show up as private, even though non have been declared
as such. Is this a safety feature of mod_ruby?
We seem to get different results.
[~]$ ruby -version
ruby 1.6.8 (2002-12-24) [i386-linux]
Sorry about that, i’m on an older version:
$ ruby -v
ruby 1.6.7 (2002-03-01) [i586-linux-gnu]
irb(main):001:0> def blah
irb(main):002:1> end
=> nil
irb(main):003:0> p respond_to? “blah”
true
=> nil
After doing a p private_methods, every single method in my
mod_ruby scripts show up as private, even though non have been declared
as such. Is this a safety feature of mod_ruby?
All methods defined at the toplevel scope go into an Object as a private
method, IIRC.
From the Pickaxe: http://www.rubycentral.com/book/classes.html#S3
“At the top level, we’re executing code in the context of some
predefined object. When we define methods, we’re actually creating
(private) singleton methods for this object.”
But then the Pickaxe was wrong on how that method worked, so YMMV
As for mod_ruby, the code will be wrapped in an anonymous module. I am
uncertain how that affects respond_to? and where “toplevel” methods
go.
···
–
([ Kent Dahl ]/)_ ~[ http://www.stud.ntnu.no/~kentda/ ]/~
))_student/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_/ö____/ (_engineering.discipline=Computer::Technology)