Object
A facade object that acts as the extension point for linguistic modules for a single language. A single instance of an inflector is generated for an object that has been extended with a Linguistics language the first time the language is used.
Create a new inflector for obj.
# File lib/linguistics/inflector.rb, line 18 def initialize( language_code, obj ) raise TypeError, "can't inflect for another inflector!" if obj.is_a?( Linguistics::Inflector ) @language_code = language_code @obj = obj super() end
Output a programmer-readable representation of the object suitable for debugging.
# File lib/linguistics/inflector.rb, line 65 def inspect return "#<(%s-language inflector) for <%s:0x%0x> >" % [ self.language, @obj.class, @obj.object_id / 2 ] end
Return the english-language name of the language the inflector is delegating for.
# File lib/linguistics/inflector.rb, line 40 def language ::Linguistics::ISO639::LANGUAGE_CODES[ self.language_code.to_sym ][:eng_name] end
Returns true if either the inflector or the object it's wrapping respond to the specified message.
# File lib/linguistics/inflector.rb, line 47 def respond_to_missing?( message, include_priv=false ) return self.obj.respond_to?( message, include_priv ) end
Delegate missing methods to the target object.
# File lib/linguistics/inflector.rb, line 79 def method_missing( sym, *args, &block ) return super unless self.obj.respond_to?( sym ) meth = self.obj.method( sym ) self.singleton_class.send( :define_method, sym, &meth ) return self.method( sym ).call( *args, &block ) end
Generated with the Darkfish Rdoc Generator 2.