Module: Hamlit::Concerns::Included

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hamlit/concerns/included.rb', line 11

def self.extended(klass)
  klass.class_eval do
    def self.included(base = nil, &block)
      if block_given?
        raise MultipleIncludedBlocks if defined?(@_included_block)

        @_included_block = block
        return
      end

      base.instance_exec(&@_included_block) if defined?(@_included_block)
      super
    end
  end
end