Class: Leap::Deliberation

Inherits:
Object
  • Object
show all
Defined in:
lib/leap/deliberation.rb

Overview

Encapsulates a single computation of a Leap subject’s decision, as performed on an instance of that subject class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(characteristics) ⇒ Deliberation

Create a new deliberation, to be made in light of the provided characteristics of the Leap subject instance.

Parameters:

  • characteristics (Hash)

    The initial set of characteristics made available to committees during deliberation.



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

def initialize(characteristics)
  self.characteristics = characteristics
  self.reports = []
end

Instance Attribute Details

#characteristicsObject

Accumulates knowledge about the Leap subject instance, beginning with the instance’s explicit attributes, and later augmented by committee proceedings.



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

def characteristics
  @characteristics
end

#reportsObject

Accumulates proceedings of the deliberation, including conclusions and methodology.



8
9
10
# File 'lib/leap/deliberation.rb', line 8

def reports
  @reports
end

Instance Method Details

#[](characteristic) ⇒ Object

Convenience method to access values within the deliberation’s characteristics hash.

Parameters:

  • characteristic (Symbol)


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

def [](characteristic)
  characteristics[characteristic]
end

#compliance(committee = nil) ⇒ Array

Report which named protocols the deliberation incidentally complied with.

Parameters:

  • committee (Symbol, optional) (defaults to: nil)

    If provided, Leap will compute this decision’s compliance with respect only to this particular conclusion within it. If not provided, compliance will be computed for the entire decision.

Returns:

  • (Array)


32
33
34
# File 'lib/leap/deliberation.rb', line 32

def compliance(committee = nil)
  (committee ? compliance_from(committee) : general_compliance) || []
end

#report(committee) ⇒ Object

Convenience method to access a certain committee’s report within this deliberation.

Parameters:

  • committee (Symbol)


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

def report(committee)
  reports.find { |r| r.committee.name == committee }
end