The Pixaxe book defines Binding objects to:
encapsulate the execution context at some particular place in the code and
retain this context for future use.
You can get a Binding for the current context by calling
Kernel#binding.
The Binding stores information about the variables, methods, and
self and you can access them by passing the Binding to
eval.
class Product
def set_title(title)
@title = title
end
def get_binding
binding
end
end
p = Product.new
p.set_title("nice and shiny")
q = Product.new
q.set_title("old and ugly")
eval "@title", p.get_binding # => "nice and shiny"
eval "@title", q.get_binding # => "old and ugly"
You can see here that @title gets evaluated differently depending on
the binding. The first eval returns "nice and shiny" because
that is the value of @title for the first Product p.
Blocks and Procs
Blocks carry information about their Binding.
a = "inside a"
a_block ...
Content suppressed by ://URLFAN, for full article visit source
Next Meeting - 7/17From: feeds.feedburner.com
Post Date: 2007-07-10 20:56:44
Just a reminder - our next meeting is coming up next Tues., 7/17, at 6:30 as usual. We’ll once again be meeting at the Building Safety Solutions office. If you need directions, you can search the mailing list archives or contact Steve Holder or Nate Murray.No Tags ...
more Foreman VideoFrom: feeds.feedburner.com
Post Date: 2007-06-27 20:09:22
Heres the video of Nate Daiger and Jason Sydes discussing Foreman, their job scheduling framework. Its a bit longer than the last one. Enjoy.
No Tags ...
more Higher Order Procedures VideoFrom: feeds.feedburner.com
Post Date: 2007-06-18 21:41:47
As an experiment, we tried recording the meeting last week. Nate Murray gave an interesting talk about Higher Order Procedures in Ruby, the video is below. Its a bit blurry, but the audio seems to have mostly come through ok.
Nate Daiger and Jason Sydes also talked about Foreman, the job scheduling framework they’ve been working on. Video of their talk will be coming a bit later this week.
No Tags ...
more Next meeting - 6/12From: feeds.feedburner.com
Post Date: 2007-05-20 13:05:26
For anybody who wasn’t able to make it last week - our next meeting will be on 6/12, 6:30 PM as usual. announcements , meetings ...
more