Parent

Included Modules

Redleaf::Namespace

A convenience class for building Redleaf::Resource objects.

Subversion Id

 $Id$

Authors

Copyright © 2008-2009, Michael Granger All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Constants

SVNRev

SVN Revision

SVNId

SVN Id

Attributes

uri[R]

The base URI of the namespace

Public Class Methods

new( uri ) click to toggle source

Set up a namespace for the specified uri.

    # File lib/redleaf/namespace.rb, line 46
46:     def initialize( uri )
47:         @uri = uri.is_a?( URI ) ? uri : URI( uri )
48:         @fragment_style = @uri.fragment ? true : false
49:     end

Public Instance Methods

[]( term ) click to toggle source

Return a fully-qualified URI for the specified term relative to the namespace.

    # File lib/redleaf/namespace.rb, line 74
74:     def []( term )
75:         term_uri = self.uri.dup
76: 
77:         if self.fragment_style?
78:             term_uri.fragment = term.to_s
79:         else
80:             term_uri.path += term.to_s
81:         end
82: 
83:         return term_uri
84:     end
fragment_style?() click to toggle source

Returns true if the resources in this namespace are indicated with URI fragments instead of a directory in its path.

    # File lib/redleaf/namespace.rb, line 62
62:     def fragment_style?
63:         return @fragment_style
64:     end
to_s() click to toggle source

Return the Redleaf::Namespace as a String

    # File lib/redleaf/namespace.rb, line 68
68:     def to_s
69:         @uri.to_s
70:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.