Skip to content

Instantly share code, notes, and snippets.

@kylefritz
Created May 29, 2013 19:39
Show Gist options
  • Save kylefritz/5673181 to your computer and use it in GitHub Desktop.
Save kylefritz/5673181 to your computer and use it in GitHub Desktop.
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