Ask a Question related to Ruby, Design and Development.
-
Elias Athanasopoulos #1
'with' proposal
Hello!
Wouldn't something like this be cool?
class Foo
def read
...
end
def dump
...
end
def is_empty?
...
end
end
f = Foo.new
with f do
read
dump
draw unless is_empty?
end
Regards,
--
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
Elias Athanasopoulos Guest
-
Proposal for a new operator - .=
OK so it's late, I'm not thinking straight, and I thought I'd post this. Proposal for a new operator - .= ================================ ... -
URGENT PROPOSAL
MRS. EKI OMORODION #8 Queens Drive Ikoyi Lagos. Email:ekiomorodion670@netscape.net INTRODUCTION: l am Mrs. Eki Omorodion l know this proposal... -
INVESTMENT PROPOSAL
This is a multi-part message in MIME format --dd1e7f93-6b57-489d-a349-90210943212c Content-Type: text/plain; charset=iso-8859-1... -
[PHP-DEV] Feature proposal
I have to fight with people that using error suppression operator - they just hide their bugs. I wrote simple patch that allows set... -
Proposal system
Am I beginning to develop a proposal system that will be types in the word, which would the best way of me be to interact with that problem, in... -
David A. Black #2
Re: 'with' proposal
Hi --
On Sun, 23 Nov 2003, Elias Athanasopoulos wrote:
irb(main):007:0> class Foo; def talk; puts "hi"; end; end> Hello!
>
> Wouldn't something like this be cool?
>
> class Foo
> def read
> ...
> end
> def dump
> ...
> end
> def is_empty?
> ...
> end
> end
>
> f = Foo.new
>
> with f do
> read
> dump
> draw unless is_empty?
> end
=> nil
irb(main):008:0> f = Foo.new
=> #<Foo:0x400b32a8>
irb(main):009:0> f.instance_eval do talk end
hi
:-)
David
--
David A. Black
[email]dblack@wobblini.net[/email]
David A. Black Guest
-
Elias Athanasopoulos #3
Re: 'with' proposal
On Sun, Nov 23, 2003 at 03:30:18AM +0900, David A. Black wrote:
Uber nice! Thanx. :-)> irb(main):007:0> class Foo; def talk; puts "hi"; end; end
> => nil
> irb(main):008:0> f = Foo.new
> => #<Foo:0x400b32a8>
> irb(main):009:0> f.instance_eval do talk end
> hi
>
> :-)
Regards,
--
University of Athens I bet the human brain
Physics Department is a kludge --Marvin Minsky
Elias Athanasopoulos Guest
-
Dan Doel #4
Re: 'with' proposal
Further:
class Foo
def talk
puts "Hi."
end
end
def with(obj, &blk)
obj.instance_eval &blk
end
f = Foo.new
with f do
talk
end
- Dan
Dan Doel Guest
-
gabriele renzi #5
Re: 'with' proposal
il Sun, 23 Nov 2003 03:26:38 +0900, Elias Athanasopoulos
<elathan@phys.uoa.gr> ha scritto::
>Hello!
>
>Wouldn't something like this be cool?
>this is a faq:>with f do
> read
> dump
> draw unless is_empty?
>end
>
def with(obj, &blk)
obj.instance_eval &blk
end
with 10 do
puts to_s
puts methods
end
gabriele renzi Guest



Reply With Quote

