Sha256: f58342c9c9a28b94773ba887b2e9509c08cd7de1d01a2f3a7f99ef0dbca365ca

Contents?: true

Size: 520 Bytes

Versions: 2

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

module God
  module Conditions
    class Lambda < PollCondition
      attr_accessor :lambda

      def valid?
        valid = true
        valid &= complain("Attribute 'lambda' must be specified", self) if self.lambda.nil?
        valid
      end

      def test
        if self.lambda.call
          self.info = 'lambda condition was satisfied'
          true
        else
          self.info = 'lambda condition was not satisfied'
          false
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resurrected_god-1.1.1 lib/god/conditions/lambda.rb
resurrected_god-1.1.0 lib/god/conditions/lambda.rb