Module Methods
Extendable module for modules with instance and class methods.
These modules can be included into each other modules and saving all chain,
including inherited or included (class) methods.
There are no conflicts with ActiveSupport::Concern.
Installation
Add this line to your application's Gemfile:
gem 'module_methods'And then execute:
bundle installOr install it yourself as:
gem install module_methodsUsage
require 'module_methods'
module SomeCommonCode
  extend ::ModuleMethods::Extension
  module ClassMethods
    def inherited(klass)
      ## manipulations with klass
    end
  end
  def some_method
    ## this is instance method
  end
end
module MoreSpecificCommonCode
  include SomeCommonCode
  module ClassMethods
    def inherited(klass)
      ## you can control the order of `inherited` execution by `super`
      ## this `super` executes `inherited` in `SomeCommonCode`
      super
    end
  end
  def some_another_method
    ## This is another instance method.
  end
end
class BaseClass
  include MoreSpecificCommonCode
  ## Instance methods from modules are here.
end
class EndPoint < BaseClass
  ## Both `inherited` from `SomeCommonCode` and `MoreSpecificCommonCode`
  ## are executing here; private methods from modules are also here.
endDevelopment
After checking out the repo, run bundle install to install dependencies.
Then, run toys rspec to run the tests.
To install this gem onto your local machine, run toys gem install.
To release a new version, run toys gem release %version%.
See how it works here.
Contributing
Bug reports and pull requests are welcome on GitHub.
License
The gem is available as open source under the terms of the MIT License.