Created
May 30, 2014 10:48
-
-
Save clodeindustrie/2710ce13d4a794cbc8b8 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
# 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