module MAbbre::Mixin

This module provides the allow_abbreviated method to Classes or Modules that extend it.

Private Instance Methods

allow_abbreviated() → set click to toggle source
allow_abbreviated() {|| ... } → set

If a block is provided all the methods defined within the block will be accessible by using a shortened version of their name as long as no abiguities are found between them.

Returns a set containing the methods that were defined within the block.

class C
  extend MAbbre::Mixin
  allow_abbreviated do
    def long_method; end
    def longer_method; end
    def longest_method; end
  end
end  #=> #<Set: {:long_method, :longer_method, :longest_method}>
# File lib/mabbre/mixin.rb, line 31
def allow_abbreviated(&b)
  track_methods(MAbbre, &b)
end
included(submodule) → submodule click to toggle source

Adds the allow_abbreviated method to submodule by extending Mixin.

Returns passed submodule.

Calls superclass method
# File lib/mabbre/mixin.rb, line 42
def included(submodule)
  super
  submodule.instance_eval { extend Mixin }
  submodule
end