Class: EventMachine::Http::MonitorFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http-monitor.rb

Defined Under Namespace

Classes: FailingMockingFileOutputter, FakeHttpClient, FileOutputter, MockingFileOutputter, StreamOutputter

Constant Summary collapse

MockNotFoundError =
Class.new(RuntimeError)
OriginalHttpRequest =
EM::HttpRequest
MockHttpRequest =
EM::MockHttpRequest

Instance Method Summary collapse

Instance Method Details

#clean_and_dump(path) ⇒ Object



45
46
47
48
49
50
# File 'lib/em-http-monitor.rb', line 45

def clean_and_dump(path)
  activate
  outputter = FileOutputter.new(path)
  outputter.reset
  install outputter
end

#deactivateObject



62
63
64
65
# File 'lib/em-http-monitor.rb', line 62

def deactivate
  decativate_mocks
  deactivate_methods
end

#debug(out = STDERR) ⇒ Object



35
36
37
38
# File 'lib/em-http-monitor.rb', line 35

def debug(out = STDERR)
  activate
  install StreamOutputter.new(out)
end

#dump(path) ⇒ Object



40
41
42
43
# File 'lib/em-http-monitor.rb', line 40

def dump(path)
  activate
  install FileOutputter.new(path)
end

#inform_receive(client, data) ⇒ Object



67
68
69
# File 'lib/em-http-monitor.rb', line 67

def inform_receive(client, data)
  @app.receive(client, data)
end

#inform_send(client, data) ⇒ Object



71
72
73
# File 'lib/em-http-monitor.rb', line 71

def inform_send(client, data)
  @app.send(client, data)
end

#install(app) ⇒ Object



75
76
77
# File 'lib/em-http-monitor.rb', line 75

def install(app)
  @app = app
end

#installedObject



79
80
81
# File 'lib/em-http-monitor.rb', line 79

def installed
  @app
end

#use(path) ⇒ Object



57
58
59
60
# File 'lib/em-http-monitor.rb', line 57

def use(path)
  activate
  install FailingMockingFileOutputter.new(path)
end

#use_and_dump(path) ⇒ Object



52
53
54
55
# File 'lib/em-http-monitor.rb', line 52

def use_and_dump(path)
  activate
  install MockingFileOutputter.new(path)
end