Sha256: ad40bc6daf17c645d8fe9f651e9d3a635b75708a469fb1d34f6cc1b4da39403d

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require_relative 'tts'
require_relative 'composer'

module AgileNotifier
  class Judger
    class << self
      def on_fail(trackable, text, args)
        on_condition(trackable.failed?, text, args)
      end
      
      def on_unstable(trackable, text, args)
        on_condition(trackable.unstable?, text, args)
      end

      def on_pass(trackable, text, args)
        on_condition(trackable.passed?, text, args)
      end

      def on_fix(trackable, text, args)
        on_condition(trackable.fixed?, text, args)
      end

      def on_limit(its, args)
        its.exceeds_limit?.each do |key, value|
          on_condition(value, "#{key} #{Composer.warn_wip_limit(args)}", args)
          sleep 1.5 if value
        end
      end

      def on_condition(condition, text, args)
        if condition
          TTS.speak(text, args)
          puts '=' * 70
          puts text
          puts '=' * 70
          true
        else
          false
        end
      end
    end

    private_class_method :on_condition
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
agile_notifier-3.1.2 lib/agile_notifier/judger.rb
agile_notifier-3.0.2 lib/agile_notifier/judger.rb
agile_notifier-3.0.1 lib/agile_notifier/judger.rb
agile_notifier-3.0.0 lib/agile_notifier/judger.rb