Class: Tap::Middlewares::Debugger
- Inherits:
-
Tap::Middleware
- Object
- App::Api
- Tap::Middleware
- Tap::Middlewares::Debugger
- Includes:
- Utils
- Defined in:
- lib/tap/middlewares/debugger.rb
Overview
:startdoc::middleware the default debugger
Defined Under Namespace
Modules: Utils Classes: InvalidSignatureError
Instance Attribute Summary
Attributes inherited from Tap::Middleware
Attributes inherited from App::Api
Instance Method Summary collapse
- #call(node, inputs = []) ⇒ Object
- #check_signature(node, inputs) ⇒ Object
- #summarize(inputs) ⇒ Object
Methods included from Utils
Methods inherited from Tap::Middleware
Methods inherited from App::Api
#associations, build, help, inherited, #initialize, parse, parse!, parser, #to_spec
Methods included from Signals
Methods included from Signals::ModuleMethods
Constructor Details
This class inherits a constructor from Tap::Middleware
Instance Method Details
#call(node, inputs = []) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/tap/middlewares/debugger.rb', line 21 def call(node, inputs=[]) open_io(output) do |io| io.puts "- - #{node.class}" io.puts " - #{summarize(inputs)}" end check_signature(node, inputs) super end |
#check_signature(node, inputs) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/tap/middlewares/debugger.rb', line 41 def check_signature(node, inputs) n = inputs.length call_arity = node.method(:call).arity unless arity_ok?(call_arity, n) raise InvalidSignatureError.new(node, inputs, :call, call_arity) end if node.kind_of?(Task) process_arity = node.method(:process).arity unless arity_ok?(process_arity, n) raise InvalidSignatureError.new(node, inputs, :process, process_arity) end end if node.kind_of?(Intern) process_block_arity = node.process_block unless arity_ok?(process_block_arity, n) raise InvalidSignatureError.new(node, inputs, :process_block, process_block_arity) end end end |
#summarize(inputs) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/tap/middlewares/debugger.rb', line 31 def summarize(inputs) unless verbose inputs = inputs.collect do |input| input.class end end inputs.inspect end |