On Nov 6, 2007 10:31 PM, Yohanes Santoso <[EMAIL PROTECTED]> wrote:

> Edwin Pratomo <[EMAIL PROTECTED]> writes:

> > good day all :-)
> >
> > mau tanya nih:
> >
> > [EMAIL PROTECTED] ~]$ irb
> > irb(main):001:0> def foo;end
> > => nil
> > irb(main):002:0> def bar;end
> > => nil
> > irb(main):003:0> Object.methods.select {|n| n =~ /foo|bar/ }
> > => ["foo", "bar"]
> > irb(main):004:0>
> >
> > [EMAIL PROTECTED] ~]$ cat <<EOF | ruby
> >> def foo;end
> >> def bar;end
> >> p Object.methods.select {|n| n =~ /foo|bar/ }
> >> EOF
> > []
> >
> > rgds,
> > Edwin.

m:tmp arie$ e prof_spec.rb
m:tmp arie$ chmod 755 prof_spec.rb
m:tmp arie$ which spec
/Library/Ruby/bin/spec
m:tmp arie$ spec -v
RSpec-1.0.8 (r2338) - BDD for Ruby
http://rspec.rubyforge.org/
m:tmp arie$ ./prof_spec.rb
F

1)
'Prof Object Golf should include foo and bar method' FAILED
expected include?("foo") to return true, got false
./prof_spec.rb:11:

Finished in 0.17662 seconds

1 example, 1 failure
m:tmp arie$ cat prof_spec.rb
#!//usr/bin/env spec

describe 'Prof Object Golf' do
  before(:each) do
    def foo; end
    def bar; end
    @object = Object.methods.uniq
  end

  it "should include foo and bar method" do
    @object.should be_include('foo')
    @object.should be_include('bar')
  end
m:tmp arie$


> ~ $ cat x
> def foo; end;
> p [Object.methods, Object.private_methods].map{|x| x.select{|y| y=~/foo/}}
>
>
> ~ $ irb1.8 x
> [["foo"], []]
>
> ~ $ ruby1.8 x
> [[], ["foo"]]
>
>
> Saya sering melihat penjeleasan perbedaan ini (kenapa dibedakan) di
> ruby-talk dulu, tapi kok susah ya carinya. Mungkin ada yang lebih
> beruntung?

hm, i must have missed that. mungkin ada keyword-keyword search yang
bisa disarankan ke saya supaya nanti saya coba cari lagi, jadi
penasaran saya -_-

> YS

-- 
Arie | http://linkedin.com/in/ariekeren
http://ariekusumaatmaja.wordpress.com | http://groups.yahoo.com/groups/id-ruby
My personal email is [EMAIL PROTECTED], this is special for
mailing list
setelah di spec baru percaya saya -_-

Kirim email ke