Class: ResponseMate::Inspector

Inherits:
Object
  • Object
show all
Defined in:
lib/response_mate/inspector.rb

Overview

Responsible for inspecting requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Inspector

Returns a new instance of Inspector


5
6
7
8
9
# File 'lib/response_mate/inspector.rb', line 5

def initialize(args = {})
  @manifest = args[:manifest]

  @conn = ResponseMate::Connection.new
end

Instance Attribute Details

#connObject

Returns the value of attribute conn


3
4
5
# File 'lib/response_mate/inspector.rb', line 3

def conn
  @conn
end

#manifestObject

Returns the value of attribute manifest


3
4
5
# File 'lib/response_mate/inspector.rb', line 3

def manifest
  @manifest
end

Instance Method Details

#inspect_key(key) ⇒ Object

Prints the output of the specified request

Parameters:

  • The (Symbol)

    key to be inspected


13
14
15
16
17
18
# File 'lib/response_mate/inspector.rb', line 13

def inspect_key(key)
  request = manifest.requests.find { |r| r.key == key }

  puts request.to_cli_format
  print_pretty(conn.fetch(request))
end