Skip to content

Instantly share code, notes, and snippets.

@trek
Created October 14, 2008 03:50
Show Gist options
  • Select an option

  • Save trek/16664 to your computer and use it in GitHub Desktop.

Select an option

Save trek/16664 to your computer and use it in GitHub Desktop.
class Thingie
attr_accessor :element
def initialize(element)
self.element = Element.new(element)
# with a block
self.element.respond_to :click do
self.element.hide
... other stuff ...
end
# or with a referenced method
self.element.respond_to :double_click, :with => :add_to_cart
end
def add_to_cart
... code ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment