Sha256: ec956a006e615d63bff8595e2c49fe4a12379a5c71018e4d98844fa007500b7d

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

#-*- mode: ruby; coding: utf-8 -*-

require 'module_plus/exception'

module ModulePlus
  module Attribute
    include ModulePlus::Exception
    module ExtendGuard
      def extended(klass)
        raise NotPermittedToExtend, "#{self.name} by #{klass}"
      end
    end

    module IncludeGuard
      def included(klass)
        raise NotPermittedToInclude, "#{self.name} by #{klass}"
      end
    end

    module ExtendOnly
      extend IncludeGuard
      def self.extended(klass)
        klass.extend(IncludeGuard)
      end
    end

    module IncludeOnly
      extend ExtendGuard
      def self.included(klass)
        klass.extend(ExtendGuard)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
module_plus-0.1.0 lib/module_plus/attribute.rb