Top Level Namespace

Includes:
Orbjson, WEBrick

Defined Under Namespace

Modules: Orbjson Classes: CGI

Constant Summary

Constants included from Orbjson

Orbjson::LibPath, Orbjson::Version

Instance Method Summary collapse

Instance Method Details

#new_from_name(classname, *args) ⇒ Object

Helper method that instatiates an object given a class name



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/utils.rb', line 14

def new_from_name( classname, *args)
  cname = String.new( classname.untaint )
  obj = nil
  begin
    obj = Object.const_get( cname ).new( *args )
  rescue Exception
    begin
      require cname
      obj = Object.const_get( cname ).new( *args )
    rescue Exception
      raise "Cannot create object #{cname}: #{$!}" unless obj
    end
  end
  obj
end