module Shackles::HelperMethods::ClassMethods
see readme for example usage
Public Instance Methods
shackle_class_method(method, opts)
click to toggle source
# File lib/shackles/helper_methods.rb, line 15 def shackle_class_method(method, opts) self.singleton_class.shackle_method(method, opts) end
shackle_class_methods(*methods, opts)
click to toggle source
# File lib/shackles/helper_methods.rb, line 11 def shackle_class_methods(*methods, opts) methods.each { |m| shackle_class_method(m, opts) } end
shackle_method(method, opts)
click to toggle source
# File lib/shackles/helper_methods.rb, line 23 def shackle_method(method, opts) @shackles_module ||= begin m = Module.new self.prepend m m end @shackles_module.class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{method}(*args) Shackles.activate(#{opts[:environment].inspect}) { super } end RUBY end
shackle_methods(*methods, opts)
click to toggle source
# File lib/shackles/helper_methods.rb, line 19 def shackle_methods(*methods, opts) methods.each { |m| shackle_method(m, opts) } end