Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/awesome_engine/core_ext/module.rb

Instance Method Summary collapse

Instance Method Details

#extend_with(mod = nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/awesome_engine/core_ext/module.rb', line 4

def extend_with(mod=nil, &block)
  if mod.nil? and not block_given?
    raise ArgumentError.new("Module#extend_with expects a module or block")
  end

  mod ||= ::Module.new(&block)
  mod.send(:extend, ActiveSupport::Concern)
  self.send(:include, mod)
end