Class: Orchestra::Conductor::ServiceRecorder

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestra/conductor.rb

Defined Under Namespace

Classes: Wrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(observable, service_name) ⇒ ServiceRecorder

Returns a new instance of ServiceRecorder.



72
73
74
75
76
# File 'lib/orchestra/conductor.rb', line 72

def initialize observable, service_name
  @observable = observable
  @service_name = service_name
  @record = []
end

Instance Attribute Details

#observableObject (readonly)

Returns the value of attribute observable.



70
71
72
# File 'lib/orchestra/conductor.rb', line 70

def observable
  @observable
end

Instance Method Details

#<<(record) ⇒ Object



78
79
80
81
82
# File 'lib/orchestra/conductor.rb', line 78

def << record
  observable.changed
  observable.notify_observers :service_accessed, service_name, record
  @record << record
end

#each(&block) ⇒ Object



84
85
86
# File 'lib/orchestra/conductor.rb', line 84

def each &block
  @record.each &block
end

#wrap(raw_service) ⇒ Object



88
89
90
# File 'lib/orchestra/conductor.rb', line 88

def wrap raw_service
  Wrapper.new raw_service, self
end