
require 'facets/sys'

# = Facets Automatic
#
# This module is included into the Object class
# and allows missing methods to be automatically
# loaded from facets.

module Facets::Automatic

  #alias method_was_missing method_missing

  def method_missing( sym, *args, &blk )
    begin
      if Facets.require(self.class, sym)
        return send( sym, *args, &blk )
      end
    rescue LoadError
      super
    end
    super
  end

end

class Object
  include Facets::Automatic
end
