Skip to content

Instantly share code, notes, and snippets.

@feliperaul
Created January 7, 2022 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliperaul/372bf2732509f3eea1cff9c7a06d7718 to your computer and use it in GitHub Desktop.
Save feliperaul/372bf2732509f3eea1cff9c7a06d7718 to your computer and use it in GitHub Desktop.
Example
class Greeter
def greet(name)
"Hello #{name}"
end
end
class User
def first_name
"Foo"
end
def greet_with(&block)
Greeter.new.instance_exec(&block)
end
def greet_first_name
greet_with { greet(first_name) }
end
end
User.new.greet_first_name
@feliperaul
Copy link
Author

@shnikola Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment