Sha256: 6a9cb1e981321c7216eb37c34c118ef1bbf8051e8b772964d73b60b14aaa01c0

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module Gleborator
  module Setup
    extend ActiveSupport::Concern

    def decorate
      begin
        decorator_class = "#{self.class.name}Decorator".constantize
        decorator_class.new(self)
      rescue NameError => e
        raise "Couldn't find decorator #{self.class.name}Decorator"
      end
    end

    module ClassMethods
      def decorate
        begin
          decorator_class = "#{self.class.name}Decorator".constantize
          decorate_class.decorate_collection(self)
        rescue NameError => e
          raise "Couldn't find decorator #{self.class.name}Decorator"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gleborator-0.1.1.3 lib/gleborator/setup.rb