Description

The 'use' package allows you to selectively mix in methods from a given
module.

Prerequisites

Ruby 1.8.0 or later

Installation

Standard

rake test (optional)
rake install

Gem install

rake test (optional)
rake install_gem

Synopsis

module Foo
   def bar
      "hello"
   end
   def baz
      "world"
   end
end

module Test
   def bar
      "goodbye"
   end
   def blah
      "new york"
   end
end

class Zap
   use Foo, :bar
   use Test, :blah
end

z = Zap.new

z.bar  # => "hello"
z.baz  # => NoMethodError
z.blah # =>"new york"

# Using the new keywords
class MyKlass
   use Foo :alias => {:bar, :test}
end

m = MyKlass.new
m.test # => "hello"
m.bar  # => NoMethodError

Constants

USE_VERSION The version of this package, returned as a String.

Acknowledgements

Thanks go to Ara Howard for providing the original solution and to
Mauricio Fernandez, whose blog I plagiarized (and with whom I communicated)
in order to implement fine-grained mixins.

Known Bugs

None that I'm aware of.  If you find any, please log them on the project
page at http://www.rubyforge.org/projects/shards.

Questions?

Please post your comment or question on one of the forums on the project
page at http://www.rubyforge.org/projects/shards.  Just click the 'Forums'
link.

License

Ruby's
(C) 2005-2007, Daniel J. Berger
All Rights Reserved

Author

Daniel J. Berger
djberg96 at gmail dot com
IRC nickname: imperator/mok (freenode)