Class: RShade::Trace

Inherits:
Object show all
Defined in:
lib/rshade/trace.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Trace

Returns a new instance of Trace.

Parameters:



6
7
8
9
# File 'lib/rshade/trace.rb', line 6

def initialize(config)
  @config = fetch_config(config)
  @event_store = EventTree.new
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/rshade/trace.rb', line 3

def config
  @config
end

#event_storeObject (readonly)

Returns the value of attribute event_store.



3
4
5
# File 'lib/rshade/trace.rb', line 3

def event_store
  @event_store
end

Class Method Details

.reveal(config = nil, &block) ⇒ Object



11
12
13
# File 'lib/rshade/trace.rb', line 11

def self.reveal(config=nil, &block)
  new(config).reveal(&block)
end

Instance Method Details

#reveal(&block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rshade/trace.rb', line 15

def reveal(&block)
  processor = EventProcessor.new(event_store, config)
  observer = EventObserver.new(config, processor)
  observable = RShade::TraceObservable.new([observer], config)
  observable.reveal &block
  self
end

#showObject



23
24
25
# File 'lib/rshade/trace.rb', line 23

def show
  config.formatter.call(event_store)
end