Class: TextPrinter

Inherits:
Printer show all
Defined in:
lib/rest.rb

Instance Method Summary collapse

Methods inherited from Printer

#do_finish, #do_prepare, #do_print, #initialize, #method_missing, #print, #print_document

Constructor Details

This class inherits a constructor from Printer

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Printer

Instance Method Details

#indent(node) ⇒ Object



381
382
383
384
385
# File 'lib/rest.rb', line 381

def indent node
  node.level.times do
    printf "  "
  end
end


439
440
441
442
# File 'lib/rest.rb', line 439

def print_body body
  indent body
  puts "Body: " + body.name
end


420
421
422
423
# File 'lib/rest.rb', line 420

def print_host host
  indent host
  puts "HOST_DEF: " + host.name
end


415
416
417
418
# File 'lib/rest.rb', line 415

def print_parameter parameter
  indent parameter
  puts "PARAMETER_DEF: " + parameter.name + " - " + parameter.description
end


393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/rest.rb', line 393

def print_request request
  indent request
  puts "Request: " + request.to_s
  host = request.host
  if ( host )
    indent host
    puts "  HOST: " + host.name
  end
  request.parameters.each do |p|
    indent request
    puts "  PARAMETER: #{p.to_s}"
  end
  request.print_children self
end


425
426
427
428
# File 'lib/rest.rb', line 425

def print_result result
  indent result
  puts "Result: " + result.name
end


387
388
389
390
391
# File 'lib/rest.rb', line 387

def print_section section
  indent section
  puts "SECTION " + section.to_s
  section.print_children self
end


408
409
410
411
412
413
# File 'lib/rest.rb', line 408

def print_text text
  text.text.each do |t|
    indent text
    puts t
  end
end


430
431
432
433
434
435
436
437
# File 'lib/rest.rb', line 430

def print_xmlresult result
  indent result
  printf "XmlResult: " + result.name
  if ( result.schema )
    printf " (Schema: #{result.schema})"
  end
  printf "\n"
end