Sha256: 0073f3ed8b269b510b01bfb9c92802f85cf8361b1afe95322d0d11b272cef62d

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

 

# Helper method to make it easier to grab the raw POST data,
# which where the JSON-RPC request is transported
class CGI
  def raw_post
    self.params.keys[0]
  end
end



# Helper method that instatiates an object given a class name
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
 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Orbjson-0.0.4 lib/utils.rb