Subversion Info

Rev
437
Last Checked In
2008-03-28 00:49:20 (2 weeks ago)
Checked in by
deveiant

Methods

Class Index

Quicksearch

Arrow::Session::MD5Id

MD5 Session IDs class.

Constants

SVNRev
SVN Revision
SVNId
SVN Id

Public Class Methods

generate( uri, request ) click to toggle source

Generate a new id

    # File /Users/ged/source/ruby/Arrow/lib/arrow/session/md5id.rb, line 41
41:     def self::generate( uri, request )
42:         seed = [
43:             Time.new.to_s,
44:             Object.new.inspect,
45:             rand(),
46:             Process.pid,
47:         ].join
48:         return Digest::MD5.hexdigest( Digest::MD5.hexdigest(seed) )
49:     end
validate( uri, idstr ) click to toggle source

Returns the validated id if the given id is in the expected form for this type, or nil if it is not.

    # File /Users/ged/source/ruby/Arrow/lib/arrow/session/md5id.rb, line 53
53:     def self::validate( uri, idstr )
54:         rval = idstr[/^([a-f0-9]{32})$/]
55:         rval.untaint
56:         return rval
57:     end

secsequence

--- SEC00111

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000130
    name: generate
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/md5id.rb, line 41</span>\n\
      41:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">generate</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">request</span> )\n\
      42:         <span class=\"ruby-identifier\">seed</span> = [\n\
      43:             <span class=\"ruby-constant\">Time</span>.<span class=\"ruby-identifier\">new</span>.<span class=\"ruby-identifier\">to_s</span>,\n\
      44:             <span class=\"ruby-constant\">Object</span>.<span class=\"ruby-identifier\">new</span>.<span class=\"ruby-identifier\">inspect</span>,\n\
      45:             <span class=\"ruby-identifier\">rand</span>(),\n\
      46:             <span class=\"ruby-constant\">Process</span>.<span class=\"ruby-identifier\">pid</span>,\n\
      47:         ].<span class=\"ruby-identifier\">join</span>\n\
      48:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-constant\">Digest</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">MD5</span>.<span class=\"ruby-identifier\">hexdigest</span>( <span class=\"ruby-constant\">Digest</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">MD5</span>.<span class=\"ruby-identifier\">hexdigest</span>(<span class=\"ruby-identifier\">seed</span>) )\n\
      49:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Generate a new id
      </p>
    params: ( uri, request )
  - visibility: public
    aref: M000131
    name: validate
    sourcecode: "    <span class=\"ruby-comment cmt\"># File /Users/ged/source/ruby/Arrow/lib/arrow/session/md5id.rb, line 53</span>\n\
      53:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-keyword kw\">self</span><span class=\"ruby-operator\">::</span><span class=\"ruby-identifier\">validate</span>( <span class=\"ruby-identifier\">uri</span>, <span class=\"ruby-identifier\">idstr</span> )\n\
      54:         <span class=\"ruby-identifier\">rval</span> = <span class=\"ruby-identifier\">idstr</span>[<span class=\"ruby-regexp re\">/^([a-f0-9]{32})$/</span>]\n\
      55:         <span class=\"ruby-identifier\">rval</span>.<span class=\"ruby-identifier\">untaint</span>\n\
      56:         <span class=\"ruby-keyword kw\">return</span> <span class=\"ruby-identifier\">rval</span>\n\
      57:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Returns the validated id if the given id is in the expected form for this
      type, or <tt>nil</tt> if it is not.
      </p>
    params: ( uri, idstr )
  category: Class
  type: Public

sectitle

--- 

constants

--- 
- name: SVNRev
  desc: |+
    
    SVN Revision
    
  value: "%q$Rev: 437 $"
- name: SVNId
  desc: |+
    
    SVN <a href="Id.html">Id</a>
    
  value: "%q$Id: md5id.rb 437 2008-03-28 00:49:20Z deveiant $"

[Validate]

Generated with the Darkfish Rdoc Generator.