Sha256: 116b966e687fb61ca6951c40fd18bddda99378ef077ea6b014de7093501a6f13

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

mpatch
======

Monkey patch collection for advance helper functions

This project aim to give flexible methods to the developer by giving new inheritance to the base classes

for example

`ruby

require 'mpatch'

class Test

  def initialize

    @hello= "world"
    @sup=   "nothing"

  end

end

puts Test.new.to_hash
#> {"hello" => "world", "sup" => "nothing"}
`

The module give you tools in your hand for inheritance handle.
For example:

`ruby
puts Models::MongoidClassName.mixin_ancestors.include? Mongoid::Document
#> true

puts Mongoid::Document.inherited_by.inspect
#> [MongoidClassName]

class Test

end

module Hello
  class World < Test
  end
end

puts Test.inherited_by.inspect
#> [Hello::World]

module ParentModule

end

module TargetModule
  include ParentModule
end

module SomeModuleThatInclude
  include TargetModule
end

class SomeClassThatInclude
  include TargetModule
end

puts TargetModule.inherited_by.inspect
#>[SomeClassThatInclude, SomeModuleThatInclude]

puts TargetModule.inherited_by(class).inspect
#>[SomeClassThatInclude]

`


But there is a lot of method, for example for modules modules / subbmodules call that retunr modules under that namespace.
Lot of metaprogrammer stuff there too :)

please do enjoy :)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mpatch-2.3.0 README.md
mpatch-2.2.4 README.md
mpatch-2.2.1 README.md