module GuardRail::HelperMethods::ClassMethods

see readme for example usage

Public Instance Methods

guard_rail_class_method(method, opts) click to toggle source
# File lib/guard_rail/helper_methods.rb, line 17
def guard_rail_class_method(method, opts)
  self.singleton_class.guard_rail_method(method, opts)
end
guard_rail_class_methods(*methods, opts) click to toggle source
# File lib/guard_rail/helper_methods.rb, line 13
def guard_rail_class_methods(*methods, opts)
  methods.each { |m| guard_rail_class_method(m, opts) }
end
guard_rail_method(method, opts) click to toggle source
# File lib/guard_rail/helper_methods.rb, line 25
      def guard_rail_method(method, opts)
        @guard_rail_module ||= begin
          m = Module.new
          self.prepend m
          m
        end

        @guard_rail_module.class_eval <<-RUBY, __FILE__, __LINE__ + 1
         def #{method}(*args)
           GuardRail.activate(#{opts[:environment].inspect}) { super }
         end
        RUBY
      end
guard_rail_methods(*methods, opts) click to toggle source
# File lib/guard_rail/helper_methods.rb, line 21
def guard_rail_methods(*methods, opts)
  methods.each { |m| guard_rail_method(m, opts) }
end