| Class | Linguistics::LanguageProxyClass |
| In: |
lib/linguistics.rb
(CVS)
|
| Parent: | Object |
A class which is inherited from by proxies for classes being extended with one or more linguistic interfaces. It provides on-the-fly creation of linguistic methods when the :installProxy option is passed to the call to Linguistics#use.
| langmod | [RW] |
Create a new LanguageProxy for the given receiver.
# File lib/linguistics.rb, line 72 def initialize( receiver ) @receiver = receiver end
Returns a human-readable representation of the languageProxy for debugging, logging, etc.
# File lib/linguistics.rb, line 104 def inspect "<%s languageProxy for %s object %s>" % [ self.class.langmod.language, @receiver.class.name, @receiver.inspect, ] end
Autoload linguistic methods defined in the module this object’s class uses for inflection.
# File lib/linguistics.rb, line 89 def method_missing( sym, *args, &block ) return super unless self.class.langmod.respond_to?( sym ) self.class.module_eval %{ def #{sym}( *args, &block ) self.class.langmod.#{sym}( @receiver, *args, &block ) end }, "{Autoloaded: " + __FILE__ + "}", __LINE__ self.method( sym ).call( *args, &block ) end