Module: Rohbau::Application

Defined in:
lib/rohbau/application.rb

Defined Under Namespace

Classes: RuntimeWrapper

Instance Method Summary collapse

Instance Method Details

#domain_requestsObject



39
40
41
# File 'lib/rohbau/application.rb', line 39

def domain_requests
  domains.map{|d| d.const_get :Request }
end

#domainsObject



35
36
37
# File 'lib/rohbau/application.rb', line 35

def domains
  @domains ||= []
end

#register_domain(name, namespace) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rohbau/application.rb', line 25

def register_domain(name, namespace)
  dummy = RuntimeWrapper.wrap do |cls|
    namespace::Runtime.start
  end

  @runtime_class.register name, dummy

  domains << namespace
end

#set_application_runtime(runtime_class) ⇒ Object



21
22
23
# File 'lib/rohbau/application.rb', line 21

def set_application_runtime(runtime_class)
  @runtime_class = runtime_class
end

#use_case_domainsObject



43
44
45
46
47
# File 'lib/rohbau/application.rb', line 43

def use_case_domains
  domains.select do |domain|
    domain.const_defined?('UseCases')
  end
end

#use_cases(use_case_domain = :all) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rohbau/application.rb', line 49

def use_cases(use_case_domain = :all)
  if use_case_domain == :all
    domains = use_case_domains
  else
    domains = [use_case_domain]
  end

  domains.inject([]) do |use_cases, domain|

    if domain.const_defined?('UseCases')
      use_case_namespace = domain.const_get('UseCases')
      use_case_namespace.constants.each do |use_case_class_name|
        use_cases << use_case_namespace::const_get(use_case_class_name)
      end
    end

    use_cases
  end
end