Forum: Ruby on Rails define_method with parameters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8a00145d61d84b58c4688cdc50bac48f?d=identicon&s=25 Wiebe Cazemier (Guest)
on 2005-12-15 14:51
(Received via mailing list)
Hi,

I'm trying to write a macro which defines methods. One of these should
have a parameter, but I can't get that to work. Something like:

define_method("printstuff") do
    puts "blabla"
end

works fine. But, how do I use define_method to create something like:

def printstuff(the_stuff)
    puts the_stuff
end

Thanks in advance.
89441a6c74647d292f5cc951eae24cfa?d=identicon&s=25 Jack Christensen (Guest)
on 2005-12-15 15:24
(Received via mailing list)
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
8a00145d61d84b58c4688cdc50bac48f?d=identicon&s=25 Wiebe Cazemier (halfgaar)
on 2005-12-15 15:49
Jack Christensen wrote:
>

Is there something wrong with the forum-to-list gateway, or is your
reply actually empty?
41165a7e7126d616a0ae0762e00718e2?d=identicon&s=25 BigSmoke (Guest)
on 2005-12-15 19:22
(Received via mailing list)
On 12/15/05, Wiebe Cazemier <halfgaar@gmail.com> wrote:
> Jack Christensen wrote:
> >
>
> Is there something wrong with the forum-to-list gateway, or is your
> reply actually empty?
>
> --
> Posted via http://www.ruby-forum.com/.

Something must be wrong with the forum-to-list gateway, since I can
see his relpy just fine.

  - Rowan
This topic is locked and can not be replied to.