Module: Realm

Defined in:
lib/realm.rb,
lib/realm/error.rb,
lib/realm/event.rb,
lib/realm/types.rb,
lib/realm/config.rb,
lib/realm/plugin.rb,
lib/realm/struct.rb,
lib/realm/builder.rb,
lib/realm/context.rb,
lib/realm/runtime.rb,
lib/realm/contract.rb,
lib/realm/container.rb,
lib/realm/dependency.rb,
lib/realm/dispatcher.rb,
lib/realm/persistence.rb,
lib/realm/event_router.rb,
lib/realm/multi_worker.rb,
lib/realm/event_factory.rb,
lib/realm/event_handler.rb,
lib/realm/health_status.rb,
lib/realm/query_handler.rb,
lib/realm/action_handler.rb,
lib/realm/command_handler.rb,
lib/realm/domain_resolver.rb,
lib/realm/mixins/reactive.rb,
lib/realm/runtime/session.rb,
lib/realm/mixins/decorator.rb,
lib/realm/mixins/controller.rb,
lib/realm/event_router/gateway.rb,
lib/realm/action_handler/result.rb,
lib/realm/mixins/aggregate_member.rb,
lib/realm/mixins/context_injection.rb,
lib/realm/mixins/repository_helper.rb,
lib/realm/mixins/dependency_injection.rb,
lib/realm/event_router/internal_loop_gateway.rb,
lib/realm/persistence/repository_query_handler_adapter.rb

Defined Under Namespace

Modules: Mixins, Types Classes: ActionHandler, Builder, CannotHandleAction, CommandHandler, CommandHandlerMissing, Config, Container, Context, Contract, Dependency, DependencyMissing, Dispatcher, DomainResolver, Error, Event, EventClassMissing, EventFactory, EventHandler, EventRouter, HealthStatus, InvalidParams, MultiWorker, Persistence, Plugin, QueryHandler, QueryHandlerMissing, Runtime, Struct

Class Method Summary collapse

Class Method Details

.bind(root_module, **options) ⇒ Object

Bind realm in service/engine



15
16
17
18
19
# File 'lib/realm.rb', line 15

def bind(root_module, **options)
  setup(root_module, **options).tap do |builder|
    root_module.define_singleton_method(:realm) { builder.runtime }
  end
end

.setup(root_module, **options) ⇒ Object

Setup realm in test/console



9
10
11
12
# File 'lib/realm.rb', line 9

def setup(root_module, **options)
  config = Realm::Config.new(root_module: root_module, **options)
  Realm::Builder.setup(config)
end

.Struct(attributes = Dry::Core::Constants::EMPTY_HASH, &block) ⇒ Object

port the construction method from Dry::Struct as it’s not inherited



22
23
24
25
26
27
# File 'lib/realm.rb', line 22

def Struct(attributes = Dry::Core::Constants::EMPTY_HASH, &block) # rubocop:disable Naming/MethodName
  Class.new(Struct) do
    attributes.each { |a, type| attribute a, type }
    module_eval(&block) if block
  end
end