Module: Leap

Defined in:
lib/leap.rb,
lib/leap/whip.rb,
lib/leap/quorum.rb,
lib/leap/report.rb,
lib/leap/subject.rb,
lib/leap/version.rb,
lib/leap/decision.rb,
lib/leap/register.rb,
lib/leap/committee.rb,
lib/leap/deliberation.rb,
lib/leap/no_solution_error.rb,
lib/leap/implicit_attributes.rb,
lib/leap/deliberations_accessor.rb,
lib/leap/goal_methods_documentation.rb

Overview

Leap is a system for: 1) describing decision-making strategies used to determine a potentially non-obvious attribute of an object and 2) computing that attribute by choosing appropriate strategies given a specific set of input information

Defined Under Namespace

Modules: DeliberationsAccessor, GoalMethodsDocumentation, ImplicitAttributes, Subject Classes: Bystander, Committee, Decision, Deliberation, NoSolutionError, Quorum, Register, Report, Shredder, Whip

Constant Summary collapse

VERSION =
"0.5.8"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Injects Leap::Subject into the host class

See Also:



25
26
27
# File 'lib/leap.rb', line 25

def self.included(base)
  base.extend ::Leap::Subject
end

.instrument(&blk) ⇒ Object

Returns the instrumentation object–or a “pass-through” substitute if not enabled



18
19
20
# File 'lib/leap/whip.rb', line 18

def instrument(&blk)
  instrument? ? @@whip : @@bystander ||= Bystander.new
end

.instrument!Object

Begin instrumenting Leap activity. Automatically enables logging.



5
6
7
8
# File 'lib/leap/whip.rb', line 5

def instrument!
  Leap.log! unless Leap.log?
  @@whip = Whip.new
end

.instrument?Boolean

Returns the instrumentation object if enabled

Returns:

  • (Boolean)


12
13
14
# File 'lib/leap/whip.rb', line 12

def instrument?
  defined?(@@whip)
end

.logObject

Returns the logging object–or a “black hole” logger if logging is not enabled.



19
20
21
# File 'lib/leap/register.rb', line 19

def log
 log? ? @@logger : @@shredder ||= Shredder.new 
end

.log!(logger = nil) ⇒ Object

Begin logging Leap activity

Parameters:

  • logger (optional) (defaults to: nil)

    An object to receive logging signals (currently #info). If not provided, Leap will log to Logger.new($stdout).



7
8
9
# File 'lib/leap/register.rb', line 7

def log!(logger = nil)
  @@logger = Register.new logger
end

.log?Boolean

Returns the logger object if logging is enabled

Returns:

  • (Boolean)


13
14
15
# File 'lib/leap/register.rb', line 13

def log?
  defined?(@@logger)
end