Skip to content

Instantly share code, notes, and snippets.

@clodeindustrie
Created May 30, 2014 10:48
Show Gist options
  • Save clodeindustrie/2710ce13d4a794cbc8b8 to your computer and use it in GitHub Desktop.
Save clodeindustrie/2710ce13d4a794cbc8b8 to your computer and use it in GitHub Desktop.
# Add nice functions to deal with roles
module Stencilable
extend ActiveSupport::Concern
extend Forwardable
def_delegators :@stencil, *stencil_caca(self).stenciled_methods
def stencil_caca(org = nil)
Black::ThirdParty::StencilFactory.get_class(
org.provider,
self.class.name.demodulize
)
end
def apply_stencil
load_stencil(self)
self
end
def load_stencil(org = nil)
@stencil = Black::ThirdParty::StencilFactory.apply(
org.provider,
org.content,
self.class.name.demodulize
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment