In Files

Parent

Request

Attributes

id[RW]
path[RW]
verb[RW]

Public Class Methods

new() click to toggle source
# File lib/rest.rb, line 131
def initialize
  @id = @@id;
  @@id += 1
  super()
end

Public Instance Methods

host() click to toggle source
# File lib/rest.rb, line 168
def host
  node = self
  while( node )
    node.children.each do |c|
      if c.is_a? Host
        return c
      end
    end
    node = node.parent
  end
  nil
end
parameters() click to toggle source
# File lib/rest.rb, line 142
def parameters
  result = Array.new
  @path.scan( /[^=]<(.*?)(\??)>/ ) do |p|
    node = self
    found = false
    optional = $2.empty? ? false : true
    while( node && !found )
      node.children.each do |c|
        if ( c.is_a?( Parameter ) && c.name == $1 )
          c.optional = optional
          result.push c
          found = true
          break
        end
      end
      node = node.parent
    end
    if ( !found )
      n = Parameter.new( $1 )
      n.optional = optional
      result.push n
    end
  end
  result
end
to_s() click to toggle source
# File lib/rest.rb, line 137
def to_s
  p = @path.gsub(/<([^>]*?)\??>=/, "\\1=")
  @verb + " " + p
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.