Class: Apache::ModRubySimObject

Inherits:
Object
  • Object
show all
Defined in:
lib/apache/fakerequest.rb

Overview

Dummy mod_ruby object base class

Direct Known Subclasses

Connection, Cookie, MultiVal, ParamTable, Request, Server, Upload

Class Attribute Summary collapse

Class Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object (private)

Handle missing methods by auto-generating method definitions



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/apache/fakerequest.rb', line 233

def method_missing( sym, *args )
	if (( source = Apache::ModRubySimObject.derivatives[ self.class ] ))
		sourcefile = source[0]
		sourceline = Integer( source[1] )

		$stderr.puts "call to missing method %s" % [ sym ]

		code = generate_method( sym, args.length )
		install_method( sourcefile, sourceline, code )

		eval( code )
		self.__send__( sym, *args )
	else
		super
	end
end

Class Attribute Details

.derivativesObject (readonly)

Returns the value of attribute derivatives.



199
200
201
# File 'lib/apache/fakerequest.rb', line 199

def derivatives
  @derivatives
end

Class Method Details

.inherited(mod) ⇒ Object



202
203
204
205
206
207
# File 'lib/apache/fakerequest.rb', line 202

def self::inherited( mod )
	@derivatives[ mod ] = caller( 1 ).first.split(/:/)
	$stderr.puts "Registering simulated %s at %p" % 
		[ mod.name, @derivatives[mod] ] if $DEBUG
	super
end