Sha256: a260412134c54d7b241148cf9c8807615282af7a23e9d432c44561829bbd920e

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module Legion
  module Extensions
    module Conditioner
      class Comparator
        def self.equal?(fact, value, values)
          values[fact] == value
        end

        def self.not_equal?(fact, value, values)
          values[fact] != value
        end

        def self.nil?(fact, values)
          values[fact].nil?
        end

        def self.not_nil?(fact, values)
          !values[fact].nil?
        end

        def self.is_false?(fact, values) # rubocop:disable Naming/PredicateName
          true unless values[fact]
        end

        def self.is_true?(fact, values) # rubocop:disable Naming/PredicateName
          values[fact]
        end

        def self.is_array?(fact, values) # rubocop:disable Naming/PredicateName
          !values[fact]
        end

        def self.is_string?(fact, values) # rubocop:disable Naming/PredicateName
          values[fact].is_a? String
        end

        def self.is_integer?(fact, values) # rubocop:disable Naming/PredicateName
          values[fact].is_a? Integer
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lex-conditioner-0.2.5 lib/legion/extensions/conditioner/helpers/comparator.rb
lex-conditioner-0.2.3 lib/legion/extensions/conditioner/helpers/comparator.rb
lex-conditioner-0.2.1 lib/legion/extensions/conditioner/helpers/comparator.rb
lex-conditioner-0.2.0 lib/legion/extensions/conditioner/helpers/comparator.rb