Skip to content

Instantly share code, notes, and snippets.

require File.dirname(__FILE__) + '/../spec_helper'
require File.dirname(__FILE__) + '/fixtures/private'
describe "The private keyword" do
it "marks following methods as being private" do
a = Private::A.new
a.methods.should_not include("bar")
lambda { a.bar }.should raise_error(NoMethodError)
b = Private::B.new
it "defines a new method rather than changing visibility of an existing one" do
Module.new do
class A
def foo
end
end
class B < A
private :foo
end
@febuiles
febuiles / foo
Created December 21, 2008 16:48
irb(main):009:0> 10.times {
begin
Resolv.getaddress("rewrq.rqweqwrw.rqww")
rescue Resolv::ResolvError
p $!
end
}
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
#<Resolv::ResolvError: no address for rewrq.rqweqwrw.rqww>
@febuiles
febuiles / foo
Created December 21, 2008 17:23
federico@korobushka
~/programacion/matzruby (origin/ruby_1_8_6)
$ ./configure --with-readline-dir=/usr/local/lib --enable-pthread
checking build system type... i686-apple-darwin9.5.0
checking host system type... i686-apple-darwin9.5.0
checking target system type... i686-apple-darwin9.5.0
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
# All versions of Emacs prior to 19.34 for Emacs and
# prior to 19.14 for XEmacs are unsupported.
# what emacs is called on your system
EMACS = emacs
# top of the installation
prefix = /usr/local
# where the Info file should go
# All versions of Emacs prior to 19.34 for Emacs and
# prior to 19.14 for XEmacs are unsupported.
# what emacs is called on your system
EMACS = emacs
# top of the installation
prefix = /usr/local
# where the Info file should go
;; Basic VM setup
(autoload 'vm "vm" "Start VM on your primary inbox." t)
(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
(autoload 'vm-mail "vm" "Send a mail message using VM." t)
(setq vm-toolbar-pixmap-directory (concat (expand-file-name "~") "/usr/local/lib/emacs/etc/vm"))
(setq vm-image-directory (concat (expand-file-name "~") "/usr/local/lib/emacs/etc/vm"))
(setenv "PATH" (concat (concat (expand-file-name "~") "/usr/local/bin") ":" (getenv "PATH")))
@febuiles
febuiles / foo
Created December 21, 2008 20:23
poll pop.gmail.com with proto POP3 and options no dns
user 'federico.builes@gmail.com' there with password 'misuperpassword' is 'federico' here options ssl
$ sc
Loading development environment (Rails 2.2.2)
>> Event.all
=> [#<Event id: 1, title: "", date: "2008-12-18", description: "">]
>> Event.find_by_date("2008-12-18") # this should return the event, right?
=> nil
$ sc
Loading development environment (Rails 2.2.2)
>> Event.all
=> [#<Event id: 1, title: "", date: "2008-12-18", description: "">]
>> Event.find_by_date(Date.parse("2008-12-18"))
=> nil