Sha256: 3af35a7e35c4f45dbd04c5e78da252fb56a825d4f00e7b206442e37ce8e9a30f

Contents?: true

Size: 535 Bytes

Versions: 7

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    class ChoiceRule
      class Boolean < Floe::Workflow::ChoiceRule
        def true?(context, input)
          if payload.key?("Not")
            !ChoiceRule.true?(payload["Not"], context, input)
          elsif payload.key?("And")
            payload["And"].all? { |choice| ChoiceRule.true?(choice, context, input) }
          else
            payload["Or"].any? { |choice| ChoiceRule.true?(choice, context, input) }
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
floe-0.3.0 lib/floe/workflow/choice_rule/boolean.rb
floe-0.2.3 lib/floe/workflow/choice_rule/boolean.rb
floe-0.2.2 lib/floe/workflow/choice_rule/boolean.rb
floe-0.2.1 lib/floe/workflow/choice_rule/boolean.rb
floe-0.2.0 lib/floe/workflow/choice_rule/boolean.rb
floe-0.1.1 lib/floe/workflow/choice_rule/boolean.rb
floe-0.1.0 lib/floe/workflow/choice_rule/boolean.rb