Class Tap::App
In: lib/tap/app.rb
lib/tap/app/api.rb
lib/tap/app/queue.rb
lib/tap/app/stack.rb
lib/tap/app/state.rb
Parent: Object

App coordinates the setup and execution of workflows.

Methods

Included Modules

Configurable MonitorMixin Signals

Classes and Modules

Module Tap::App::State
Class Tap::App::Api
Class Tap::App::Queue
Class Tap::App::Stack

Constants

CONTEXT = 'tap.context'   A variable to store the application context in Thread.current
CURRENT = 'tap.current'   A variable to store an instance in the application context.
CALL_KEYS = %w{obj sig args}   The reserved call keys
INIT_KEYS = %w{var class spec}   The reserved init keys
RESERVED_KEYS = CALL_KEYS + INIT_KEYS   Reserved call and init keys as a single array
OBJECT = /\A(.*)\/(.*)\z/   Splits a signal into an object string and a signal string. If OBJECT doesn‘t match, then the string can be considered a signal, and the object is nil. After a match:
  $1:: The object string
       (ex: 'obj/sig' => 'obj')
  $2:: The signal string
       (ex: 'obj/sig' => 'sig')
LOG_FORMAT = "%s %8s %10s %s\n"   The default log format
LOG_FORMATTER = lambda do |severity, time, head, tail| code = (severity == 'INFO' ? ' ' : severity[0,1])   The default logger formatter — uses LOG_FORMAT

Public Class methods

[Source]

    # File lib/tap/app.rb, line 39
39:       def build(spec={}, app=current)
40:         config  = spec['config'] || {}
41:         signals = spec['signals'] || []
42:         
43:         if spec['self']
44:           app.reconfigure(config)
45:         else
46:           app = new(config, :env => app.env)
47:         end
48:         
49:         signals.each do |args|
50:           app.call(args)
51:         end
52:         
53:         app.gc
54:         app
55:       end

[Source]

    # File lib/tap/app.rb, line 27
27:       def context
28:         Thread.current[CONTEXT] ||= {}
29:       end

[Source]

    # File lib/tap/app.rb, line 35
35:       def current
36:         context[CURRENT] ||= new
37:       end

[Source]

    # File lib/tap/app.rb, line 31
31:       def current=(app)
32:         context[CURRENT] = app
33:       end

[Source]

    # File lib/tap/app.rb, line 12
12:       def set_context(context={})
13:         current = Thread.current[CONTEXT]
14:         Thread.current[CONTEXT] = context
15:         current
16:       end

[Source]

    # File lib/tap/app.rb, line 18
18:       def with_context(context)
19:         begin
20:           current = set_context(context)
21:           yield
22:         ensure
23:           set_context(current)
24:         end
25:       end

[Validate]