In Files

Parent

Methods

Document

Public Class Methods

new() click to toggle source
# File lib/rest.rb, line 250
def initialize
  super
  self.name = "DOCUMENT"
end

Public Instance Methods

parse_args() click to toggle source
# File lib/rest.rb, line 255
def parse_args
  sections = Hash.new

  sections[ 0 ] = self

  @section = nil

  while line = gets
    if ( line =~ /^\s+(\S.*)$/ )
      if ( !@text )
        @text = Text.new
      end
      @text.append $1
    else
      if ( @text && @current )
        @current.add_child @text
      end
      @text = nil
    end

    if ( line =~ /^(=+) (.*)/ )
      level = $1.size
      title = $2

      @section = Section.new title
      @current = @section

      parent = sections[ level - 1 ]
      parent.add_child @section
      sections[ level ] = @section

    elsif ( line =~ /^(GET|PUT|POST|DELETE) (.*)/ )
      @request = Request.new
      @current = @request

      @request.verb = $1
      @request.path = $2

      @section.add_child( @request )

    elsif ( line =~ /^<(.*)>: (.*)/ )
      parameter = Parameter.new

      parameter.name = $1
      parameter.description = $2

      @current.add_child( parameter )

    elsif ( line =~ /^Host: (.*)/ )
      host = Host.new $1
      @current.add_child( host )

    elsif ( line =~ /^Body: (.*)/ )
      body = Body.new $1
      @current.add_child( body )

    elsif ( line =~ /^Result: (.*)/ )
      result = Result.new $1
      @current.add_child( result )

    elsif ( line =~ /^XmlBody: (.*)/ )
      body = XmlBody.new $1
      @current.add_child( body )

    elsif ( line =~ /^XmlResult: (.*) +(.*)/ )
      result = XmlResult.new $1
      result.schema = $2
      @current.add_child( result )

    elsif ( line =~ /^XmlResult: (.*)/ )
      result = XmlResult.new $1
      @current.add_child( result )

    elsif ( line =~ /^Contents/ )
      @current.add_child( Contents.new )

    elsif ( line =~ /^Version: (.*)/ )
      version = Version.new $1
      @current.add_child( version )

    end

  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.