Class: TTK::Monitors::Client

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/ttk/monitors/Client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, monitor) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
# File 'lib/ttk/monitors/Client.rb', line 14

def initialize(service, monitor)
  @service = service
  @monitor = monitor
  @monitor.add_observer(self)
end

Instance Attribute Details

#monitorObject (readonly)

Returns the value of attribute monitor.



20
21
22
# File 'lib/ttk/monitors/Client.rb', line 20

def monitor
  @monitor
end

Instance Method Details

#update(service, type, time, *args, &block) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ttk/monitors/Client.rb', line 26

def update(service, type, time, *args, &block)
  puts " - service: #{service}"
  puts "   type: #{type}"
  puts "   time: #{time}"
  begin
    contents = pp_contents(type, *args)
  rescue
    contents = $!.long_pp
  end
  puts "   contents: \"#{contents}\""
end

#uriObject



22
23
24
# File 'lib/ttk/monitors/Client.rb', line 22

def uri
  @service.uri
end