Class: OFlow::Env

Inherits:
Object
  • Object
show all
Extended by:
HasErrorHandler, HasLog, HasName, HasTasks
Defined in:
lib/oflow/env.rb

Overview

The platform that Flows are created in. It is the outer most element of the OFlow system.

Constant Summary collapse

@@log_level =

The default logging level.

Logger::WARN

Instance Attribute Summary

Attributes included from HasName

#name

Class Method Summary collapse

Methods included from HasTasks

_locate, _validation_errors, busy?, clear, each_task, find_task, flow, flush, init_tasks, locate, queue_count, resolve_all_links, shutdown, start, state=, step, stop, task, task_count, validate, wakeup, walk_tasks

Methods included from HasLog

debug, error, fatal, info, log, log=, log_msg, warn

Methods included from HasName

full_name, init_name

Methods included from HasErrorHandler

error_handler, error_handler=, handle_error

Class Method Details

._clearObject

Resets the error handler and log. Usually called on init and by the clear() method.



33
34
35
36
# File 'lib/oflow/env.rb', line 33

def self._clear()
  @error_handler = Task.new(self, :error, Actors::ErrorHandler)
  @log = Task.new(self, :log, Actors::Log)
end

.describe(detail = 0, indent = 0) ⇒ Object

Describes all the Flows and Tasks in the system.



41
42
43
44
45
46
47
48
49
# File 'lib/oflow/env.rb', line 41

def self.describe(detail=0, indent=0)
  i = ' ' * indent
  lines = ["#{i}#{self} {"]
  @tasks.each_value { |t|
    lines << t.describe(detail, indent + 2)
  }
  lines << i + "}"
  lines.join("\n")
end

.log_levelFixnum

Returns the default log level.

Returns:

  • (Fixnum)

    the default log level which is one of the Logger::Severity values.



21
22
23
# File 'lib/oflow/env.rb', line 21

def self.log_level()
  @@log_level
end

.log_level=(level) ⇒ Object

Sets the default log level.

Parameters:

  • level (Fixnum)

    Logger::Severity to set the default log level to



27
28
29
# File 'lib/oflow/env.rb', line 27

def self.log_level=(level)
  @@log_level = level unless level < Logger::Severity::DEBUG || Logger::Severity::FATAL < level
end