Class: Printer
- Inherits:
-
Object
show all
- Defined in:
- lib/rest.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Printer.
345
346
347
|
# File 'lib/rest.rb', line 345
def initialize
@missing = Hash.new
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
370
371
372
373
374
375
|
# File 'lib/rest.rb', line 370
def method_missing symbol, *args
if ( !@missing[ symbol ] )
@missing[ symbol ] = true
STDERR.puts "Warning: #{self.class} doesn't support '#{symbol}'."
end
end
|
Instance Method Details
#do_finish ⇒ Object
367
368
|
# File 'lib/rest.rb', line 367
def do_finish
end
|
#do_prepare ⇒ Object
364
365
|
# File 'lib/rest.rb', line 364
def do_prepare
end
|
#do_print(node) ⇒ Object
359
360
361
362
|
# File 'lib/rest.rb', line 359
def do_print node
method = "print_" + node.class.to_s.downcase
send method, node
end
|
#print(node) ⇒ Object
349
350
351
352
353
|
# File 'lib/rest.rb', line 349
def print node
do_prepare
do_print node
do_finish
end
|
#print_document(printer) ⇒ Object
355
356
357
|
# File 'lib/rest.rb', line 355
def print_document printer
print_section printer
end
|