-
-
Save szimek/1526bf48b78eee94e6f0 to your computer and use it in GitHub Desktop.
This file contains 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 define_hash_access(route, name, kind, options) | |
selector = hash_access_name(name, kind) | |
# We use module_eval to avoid leaks | |
@module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1 | |
def #{selector}(options = nil) # def hash_for_users_url(options = nil) | |
options ? #{options.inspect}.merge(options) : #{options.inspect} # options ? {:only_path=>false}.merge(options) : {:only_path=>false} | |
end # end | |
protected :#{selector} # protected :hash_for_users_url | |
END_EVAL | |
helpers << selector | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment