module EventSourcing::Application

Attributes

name[R]

Public Class Methods

inspect() click to toggle source
# File lib/event_sourcing/application.rb, line 18
def inspect
  "EventSourcing::Application(#{name})"
end
new(name) click to toggle source
# File lib/event_sourcing/application.rb, line 5
def self.new(name)
  Class.new do

    @name = name

    class << self

      attr_reader :name

      def run!(options = {})
        new(Array(options[:event_store]))
      end

      def inspect
        "EventSourcing::Application(#{name})"
      end
    end
    
    def initialize(options)
      @actor = Actor.spawn!(name: self.class.name, args: options)
    end
new(options) click to toggle source
# File lib/event_sourcing/application.rb, line 23
def initialize(options)
  @actor = Actor.spawn!(name: self.class.name, args: options)
end
run!(options = {}) click to toggle source
# File lib/event_sourcing/application.rb, line 14
def run!(options = {})
  new(Array(options[:event_store]))
end

Public Instance Methods

execute_command(command) click to toggle source
# File lib/event_sourcing/application.rb, line 31
def execute_command(command)
  @actor.execute_command(command)
end
shutdown() click to toggle source
# File lib/event_sourcing/application.rb, line 27
def shutdown
  @actor.terminate!
end