Sha256: df3e1bfd72f0588bb407072dcf9a79e08e718a008d65a8fad45ee0c6ec500186

Contents?: true

Size: 494 Bytes

Versions: 20

Compression:

Stored size: 494 Bytes

Contents

module Shogun
  module Verifier
    class Allowed
      def initialize(name:, data:, list: [])
        @data = data
        @name = name
        @list = list || []
      end

      def valid?
        @data.all?(&method(:allowed?))
      end

      def id
        "#{@name}_not_allowed"
      end

      def context
        {
          "unallowed" => @data.reject(&method(:allowed?))
        }
      end

      private def allowed?(item)
        @list.include?(item)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shogun-6.4.2 lib/shogun/verifier/allowed.rb
shogun-6.4.1 lib/shogun/verifier/allowed.rb
shogun-6.4.0 lib/shogun/verifier/allowed.rb
shogun-6.3.0 lib/shogun/verifier/allowed.rb
shogun-6.2.3 lib/shogun/verifier/allowed.rb
shogun-6.2.2 lib/shogun/verifier/allowed.rb
shogun-6.2.1 lib/shogun/verifier/allowed.rb
shogun-6.2.0 lib/shogun/verifier/allowed.rb
shogun-6.1.0 lib/shogun/verifier/allowed.rb
shogun-6.0.0 lib/shogun/verifier/allowed.rb
shogun-4.0.1 lib/shogun/verifier/allowed.rb
shogun-4.0.0 lib/shogun/verifier/allowed.rb
shogun-3.4.0 lib/shogun/verifier/allowed.rb
shogun-3.2.0 lib/shogun/verifier/allowed.rb
shogun-3.1.0 lib/shogun/verifier/allowed.rb
shogun-3.0.0 lib/shogun/verifier/allowed.rb
shogun-2.1.1 lib/shogun/verifier/allowed.rb
shogun-2.1.0 lib/shogun/verifier/allowed.rb
shogun-2.0.0 lib/shogun/verifier/allowed.rb
shogun-1.0.0 lib/shogun/verifier/allowed.rb