Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created October 31, 2016 17:14
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 anonymous/3ee119a656c001ab08bb0761cd38753e to your computer and use it in GitHub Desktop.
Save anonymous/3ee119a656c001ab08bb0761cd38753e to your computer and use it in GitHub Desktop.
module Authz
module Authorizable
def authorize(method, permission)
return if method.nil? || permission.nil?
authorizer = Module.new do
define_method(method) do |*args, &block|
# stuff here...
end
end
prepend authorizer
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment