Class: DEVp2p::Service
- Inherits:
-
Object
show all
- Extended by:
- Configurable
- Includes:
- Concurrent::Async
- Defined in:
- lib/devp2p/service.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
add_config
Constructor Details
#initialize(app) ⇒ Service
Returns a new instance of Service.
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/devp2p/service.rb', line 23
def initialize(app)
super()
@app = app
@config = app.config.reverse_merge(default_config)
available_services = app.services.each_value.map(&:class)
required_services.each do |r|
raise MissingRequiredServiceError, "require service #{r}" unless available_services.include?(r)
end
end
|
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
21
22
23
|
# File 'lib/devp2p/service.rb', line 21
def app
@app
end
|
Class Method Details
.register_with_app(app) ⇒ Object
16
17
18
|
# File 'lib/devp2p/service.rb', line 16
def register_with_app(app)
app.register_service self, app
end
|
Instance Method Details
#start ⇒ Object
35
36
37
|
# File 'lib/devp2p/service.rb', line 35
def start
raise NotImplemented
end
|
#stop ⇒ Object
39
40
41
|
# File 'lib/devp2p/service.rb', line 39
def stop
raise NotImplemented
end
|
#to_s ⇒ Object
Also known as:
inspect
43
44
45
|
# File 'lib/devp2p/service.rb', line 43
def to_s
"<Service #{name}##{object_id}>"
end
|