Skip to content

Instantly share code, notes, and snippets.

@1dolinski
Last active December 17, 2015 23:49
Show Gist options
  • Select an option

  • Save 1dolinski/5691941 to your computer and use it in GitHub Desktop.

Select an option

Save 1dolinski/5691941 to your computer and use it in GitHub Desktop.
module TestHelper
def person(name ="Sarah", &block)
Person.new(self, name, block)
end
end
class Person < Struct.new(:view, :age, :callback)
delegate :content_tag, to: :view
# a block is an argument for the method which is called in the view
# person @names do |name|
# .. ...
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment