Created
April 3, 2021 15:05
-
-
Save freakflames29/cf265dba4019791b2a9d1ff6e2ea7785 to your computer and use it in GitHub Desktop.
passing symbols as an argument to a function which calls the same name function as the symbol name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_name | |
puts "Your name is good" | |
end | |
def before_action (func) | |
method(func).call | |
end | |
before_action :set_name | |
# it is a normal ruby code which takes symbols and call the same name function as symbol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment