Class: HecksApp::ApplicationPort
- Inherits:
-
Object
- Object
- HecksApp::ApplicationPort
show all
- Includes:
- Singleton
- Defined in:
- lib/hecks-app.rb,
lib/application_port/event.rb,
lib/application_port/command_runner.rb,
lib/application_port/command_runner/event.rb
Defined Under Namespace
Classes: CommandRunner, Event
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ApplicationPort.
14
15
16
17
18
|
# File 'lib/hecks-app.rb', line 14
def initialize
@adapters = []
@domain = nil
@event = Event
end
|
Instance Attribute Details
#adapters ⇒ Object
Returns the value of attribute adapters.
12
13
14
|
# File 'lib/hecks-app.rb', line 12
def adapters
@adapters
end
|
#event ⇒ Object
Returns the value of attribute event.
12
13
14
|
# File 'lib/hecks-app.rb', line 12
def event
@event
end
|
Class Method Details
.[](value) ⇒ Object
51
52
53
|
# File 'lib/hecks-app.rb', line 51
def self.[](value)
CommandRunner.new(value)
end
|
.config(&block) ⇒ Object
34
35
36
37
|
# File 'lib/hecks-app.rb', line 34
def self.config(&block)
instance.instance_eval(&block)
instance.event.emit(:AppConfigured)
end
|
.domain ⇒ Object
43
44
45
|
# File 'lib/hecks-app.rb', line 43
def self.domain
instance.domain_get
end
|
.domain_object_from_repository(repository) ⇒ Object
26
27
28
|
# File 'lib/hecks-app.rb', line 26
def self.domain_object_from_repository(repository)
const_get(repository.to_s.gsub('::Repository', ''))
end
|
.find_aggregate(name) ⇒ Object
30
31
32
|
# File 'lib/hecks-app.rb', line 30
def self.find_aggregate(name)
domain::Domain.const_get(name)
end
|
.in_repository(aggregate) ⇒ Object
20
21
22
23
24
|
# File 'lib/hecks-app.rb', line 20
def self.in_repository(aggregate)
aggregate::Root::Repository.class_eval do
yield
end
end
|
.subscribe(subscriber, event) ⇒ Object
39
40
41
|
# File 'lib/hecks-app.rb', line 39
def self.subscribe(subscriber, event)
instance.event.subscribe(subscriber, event)
end
|
Instance Method Details
#adapter(name) ⇒ Object
60
61
62
63
64
65
|
# File 'lib/hecks-app.rb', line 60
def adapter(name)
Adapters.const_get(name).new.tap do |adapter|
adapter.load
@adapters << adapter
end
end
|
#domain(domain) ⇒ Object
55
56
57
58
|
# File 'lib/hecks-app.rb', line 55
def domain(domain)
@domain = domain
require_relative 'application_port/domain_schema'
end
|
#domain_get ⇒ Object
47
48
49
|
# File 'lib/hecks-app.rb', line 47
def domain_get
@domain
end
|