Sha256: 5614f7ce3abb780417c3e49c3526fa3d0f892e8d6b25632a5fd98231998d4d93

Contents?: true

Size: 615 Bytes

Versions: 14

Compression:

Stored size: 615 Bytes

Contents

module LitmusPaper
  class Health

    attr_reader :summary

    def initialize
      @value = 0
      @dependencies_available = true
      @summary = ""
    end

    def ok?
      value > 0
    end

    def value
      return 0 unless @dependencies_available
      @value
    end

    def perform(metric)
      health = metric.current_health

      @value += health
      @summary << "#{metric}: #{health}\n"
    end

    def ensure(dependency)
      available = dependency.available?

      @dependencies_available &&= available
      @summary << "#{dependency}: #{available ? 'OK' : 'FAIL'}\n"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
litmus_paper-0.6.1 lib/litmus_paper/health.rb
litmus_paper-0.6.0 lib/litmus_paper/health.rb
litmus_paper-0.5.0 lib/litmus_paper/health.rb
litmus_paper-0.4.0 lib/litmus_paper/health.rb
litmus_paper-0.3.5 lib/litmus_paper/health.rb
litmus_paper-0.3.3 lib/litmus_paper/health.rb
litmus_paper-0.3.2 lib/litmus_paper/health.rb
litmus_paper-0.3.1 lib/litmus_paper/health.rb
litmus_paper-0.3.0 lib/litmus_paper/health.rb
litmus_paper-0.2.2 lib/litmus_paper/health.rb
litmus_paper-0.2.1 lib/litmus_paper/health.rb
litmus_paper-0.2.0 lib/litmus_paper/health.rb
litmus_paper-0.1.0 lib/litmus_paper/health.rb
litmus_paper-0.0.3 lib/litmus_paper/health.rb