Sha256: 966ea04ff6edf4961299a220b9a48a29516688083eb4caf600f9f7d41b3f0121

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

module Leap
  module Trace
    def trace
      @deliberations.inject({}) do |delibs, (goal, deliberation)|
        delibs[goal] = deliberation.reports.inject([]) do |reports, report|
          item = {
            :committee => report.committee.name,
            :quorum => report.quorum.name,
            :result => deliberation[report.committee.name].to_s,
          }

          item[:params] = report.quorum.characteristics.inject({}) do |hsh, name|
            hsh[name] = deliberation[name].to_s
            hsh
          end

          item[:compliance] = report.quorum.compliance

          reports << item
        end
        delibs
      end
    end

    def trace_report
      trace.each do |goal, steps|
        puts goal
        if steps
          steps.each do |step|
            puts "  #{step[:committee]} #{step[:quorum]}"
            unless step[:params].empty?
              puts "    Params: "
              step[:params].inspect.split("\n").each { |p| puts "      #{p}" }
            end
            puts "    Complies: "
            puts "      #{step[:compliance]}"
            puts "    Result: #{step[:result].inspect}\n"
          end
        else
          puts "  Not computed"
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sniff-1.1.1 lib/sniff/leap_ext.rb
sniff-1.1.0 lib/sniff/leap_ext.rb
sniff-1.0.1 lib/sniff/leap_ext.rb
sniff-1.0.0 lib/sniff/leap_ext.rb
sniff-0.11.12 lib/sniff/leap_ext.rb
sniff-0.11.11 lib/sniff/leap_ext.rb
sniff-0.11.10 lib/sniff/leap_ext.rb
sniff-0.11.9 lib/sniff/leap_ext.rb
sniff-0.11.8 lib/sniff/leap_ext.rb
sniff-0.11.7 lib/sniff/leap_ext.rb
sniff-0.11.6 lib/sniff/leap_ext.rb
sniff-0.11.5 lib/sniff/leap_ext.rb
sniff-0.11.4 lib/sniff/leap_ext.rb
sniff-0.11.3 lib/sniff/leap_ext.rb
sniff-0.11.2 lib/sniff/leap_ext.rb