Class: Foo

Inherits:
Object
  • Object
show all
Includes:
Hallmonitor::Monitored
Defined in:
bin/example.rb

Instance Method Summary collapse

Methods included from Hallmonitor::Monitored

#emit, included, #watch

Instance Method Details

#do_somethingObject



17
18
19
20
21
# File 'bin/example.rb', line 17

def do_something
  sleep_time_ms = ((Random.rand * 100).floor) * 2
  puts "Sleeping for #{sleep_time_ms} milliseconds"
  sleep(sleep_time_ms / 1000.0)
end

#emit_events(count = 30) ⇒ Object



25
26
27
28
29
30
31
# File 'bin/example.rb', line 25

def emit_events(count=30)
  # Emit 100 events
  count.times do
    emit("event")
    sleep(1)
  end
end

#time_meObject



33
34
35
36
37
# File 'bin/example.rb', line 33

def time_me
  watch("timed") do |x|
    sleep(5)
  end
end