Sha256: cbfe361799676b8e4e0f29372103b6c9c7baf1d3ed9b365b1a71b9d8822eed6b

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

require 'structure_mapper'
require 'securerandom'
require 'celluloid'
require 'celluloid/autostart'
require 'nestene/storage'
require 'nestene/actor/delayed_scheduler'
require 'nestene/actor/core'
require 'nestene/actor/auton_storage'
require 'nestene/actor/auton_queue'
require 'nestene/auton_context'
require 'nestene/callback'
require 'nestene/scheduled_method'
require 'nestene/executing_method'
require 'nestene/execution_error'
require 'nestene/executed_method'
require 'nestene/auton_execution_queue'
require 'nestene/auton_state'
require 'nestene/ui/app'

module Nestene

  class Registry

    def self.register_auton(type)
      @registered_autons ||= []
      @registered_autons << type unless @registered_autons.include?(type)
    end


    def self.registered_autons
      (@registered_autons || []).map(&:to_s)
    end

  end

  class FooAuton
    include StructureMapper::Hash

    def do_foo
    end

    attribute foo: String
  end

  Registry.register_auton(FooAuton)

  class SelfValue
    def value
      self
    end
  end

  def self.class_from_string(name)
    name.split('::').inject(Object) do |mod, class_name|
      mod.const_get(class_name) or raise "Could not find class #{name}"
    end
  end

  def self.start_nestene(storage)
    Celluloid::Actor[:delayed_scheduler] = Nestene::Actor::DelayedScheduler.new
    Celluloid::Actor[:nestene_core] = Nestene::Actor::Core.new(storage)
    Celluloid::Actor[:auton_queue] = Nestene::Actor::AutonQueue.new
  end

end

class Time
  def self.from_structure str
    str ? iso8601(str) : nil
  end

  def to_structure
    iso8601(3)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nestene-0.1.8 lib/nestene.rb
nestene-0.1.7 lib/nestene.rb