module Realm::Mixins::Controller
Public Class Methods
included(base)
click to toggle source
# File lib/realm/mixins/controller.rb, line 6 def self.included(base) base.class_attribute(:aggregate_name) base.extend(ClassMethods) end
Public Instance Methods
domain_context()
click to toggle source
# File lib/realm/mixins/controller.rb, line 15 def domain_context {} end
domain_runtime()
click to toggle source
# File lib/realm/mixins/controller.rb, line 11 def domain_runtime @domain_runtime ||= root_domain_runtime.session(domain_context) end
query(identifier, params = {})
click to toggle source
# File lib/realm/mixins/controller.rb, line 19 def query(identifier, params = {}) domain_runtime.query(get_dispatchable(identifier), params) end
run(identifier, params = {})
click to toggle source
# File lib/realm/mixins/controller.rb, line 23 def run(identifier, params = {}) domain_runtime.run(get_dispatchable(identifier), params) end
run_as_job(identifier, params = {})
click to toggle source
# File lib/realm/mixins/controller.rb, line 27 def run_as_job(identifier, params = {}) domain_runtime.run_as_job(get_dispatchable(identifier), params) end
Private Instance Methods
get_dispatchable(identifier)
click to toggle source
# File lib/realm/mixins/controller.rb, line 33 def get_dispatchable(identifier) return identifier if identifier.respond_to?(:call) [aggregate_name, identifier].compact.join('.') end
root_domain_runtime()
click to toggle source
# File lib/realm/mixins/controller.rb, line 39 def root_domain_runtime self.class.module_parents[-2].realm end