From: David Douthitt Date: 2000-06-09T16:39:24-05:00 Subject: [ruby-talk:03233] Making a class method private This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=_451D3031.38593CFD Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable I have code like this: #!/opt/ruby/bin/ruby # ruby 1.4.3 (1999-12-08) [hppa1.1-hpux10.20] # HP-UX whatever! B.10.20 A 9000/861 --- two-user license class Foo def Foo.one [ "one", "two", "three" ] end private Foo.one def Foo.two Foo.one.each { |el| print "howdy, ", el, "!\n" } end end It returns: ./test:11:in `private': failed to convert Array into Integer (TypeError) from ./test:11 If I change the "private" line to be: private :Foo.one I get ./test:11: undefined method `one' for 8405:Fixnum (NameError) If I change it to be one of the following: private :(Foo.one) private Foo.:one I get parse errors. --=_451D3031.38593CFD Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I have code like this:
 
#!/opt/ruby/bin/ruby
 
# ruby 1.4.3 (1999-12-08) [hppa1.1-hpux10.20]
# = HP-UX=20 whatever! B.10.20 A 9000/861 --- two-user license
 
class Foo
   def=20 Foo.one
      [ "one", "two", "three"=20 ]
   end
 
   private Foo.one
 
   def Foo.two
    &nb= sp;=20 Foo.one.each { |el|
         = print=20 "howdy, ", el, "!\n"
        =20= }
   end
end
 
It returns:
 
./test:11:in `private': failed to convert Array into = Integer=20 (TypeError)
        from=20 ./test:11
 
If I change the "private" line to be:
 
private :Foo.one
 
I get
 
./test:11: undefined method `one' for 8405:Fixnum=20 (NameError)
 
If I change it to be one of the following:
=
 
private :(Foo.one)
 
private Foo.:one
 
I get parse errors.
 
 
--=_451D3031.38593CFD--