Created
May 29, 2013 19:39
-
-
Save kylefritz/5673181 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
module IndecentExposure | |
extend ActiveSupport::Concern | |
module ClassMethods | |
private | |
def expose(name, &block) | |
var = "@#{name}" | |
define_method(name) do | |
instance_variable_set(var, instance_variable_get(var) || instance_eval(&block)) | |
end | |
private(name) | |
helper_method name | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment