Class: Awt::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/awt/printer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ Printer

Returns a new instance of Printer.



5
6
7
# File 'lib/awt/printer.rb', line 5

def initialize(host)
  @host = host
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(action, *args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/awt/printer.rb', line 9

def method_missing(action, *args)
  if action.to_s =~ /print_(.+)/
    puts "[#{@host}] #{$1}: #{args.first}"
  else
    super
  end
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/awt/printer.rb', line 3

def host
  @host
end