class Ergo::System

A system stores defined states and rules and books, which are subsystems.

Attributes

books[R]

Map of books by name.

Returns [Hash]

Public Class Methods

new(script=nil, options={}) click to toggle source

Initialize new System instance.

# File lib/ergo/system.rb, line 17
def initialize(script=nil, options={})
  extend self
  extend ShellUtils

  @ignore  = options[:ignore] || Ignore.new
  @session = OpenStruct.new

  @scripts = []
  @rules   = []
  @states  = {}
  @books   = {}
  @digests = {}

  import script if script
end

Public Instance Methods

book(name, &block) click to toggle source

Books are stored with rules to preserve order of application.

Return [Book]

# File lib/ergo/system.rb, line 41
def book(name, &block)
  @books[name.to_s] ||= (
    book = Book.new(self, name, &block)
    @rules << book
    book
  )
end