align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo
Jack W.
Baltimore, MD
Post #: 5
[withdrawing because I have lost the source code I had exhibited (internal link rot); sorry]
Jack W.
Baltimore, MD
Post #: 6
[portion withdrawn on edit because I lost my exhibit code]

I don't like to "eval" or anything like that; most of my metaprogramming in Ruby is based on the ability to place closures as methods.

I just found out an interesting "feature" of closures in Ruby. If you don't give an explicit parameter list in your block, Ruby doesn't complain if you pass arguments. See:

>> lambda{3}.call 2
=> 3
>> lambda{||3}.call 2
ArgumentError: wrong number of arguments (1 for 0)
A former member
Post #: 1

f =
f[:example] = 3

You probably already know this, but this is also what the OpenStruct class in the Ruby standard library does :-)
Powered by mvnForum

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy