Skip to content

Instantly share code, notes, and snippets.

@kylefritz
Created May 29, 2013 19:39
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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