class Decorator

Attributes

decorators[RW]

Public Class Methods

decorator_name(name) click to toggle source
# File lib/performance_promise/decorators.rb, line 65
def decorator_name(name)
  Decorator.decorators ||= {}
  Decorator.decorators[name] = self
end
inherited(klass) click to toggle source
# File lib/performance_promise/decorators.rb, line 71
  def self.inherited(klass)
    name = klass.name.gsub(/^./) {|m| m.downcase}

    return if name =~ /^[^A-Za-z_]/ || name =~ /[^0-9A-Za-z_]/

    MethodDecorators.module_eval <<-ruby_eval, __FILE__, __LINE__ + 1
      def #{klass}(*args, &blk)
        decorate(#{klass}, *args, &blk)
      end
    ruby_eval
  end
new(klass, method) click to toggle source
# File lib/performance_promise/decorators.rb, line 83
def initialize(klass, method)
  @method = method
end