Sha256: 1b9ade490a97d0b7dd130e79370deea87525e458c80e557c0abd289701a1e7d1

Contents?: true

Size: 455 Bytes

Versions: 2

Compression:

Stored size: 455 Bytes

Contents

module SimpleService
  class ValidatesExpectedKeys < Command

    expects :expected_keys, :provided_keys

    skip_validation true

    def call
      arguments_not_included = expected_keys.to_a - provided_keys.to_a

      if arguments_not_included.any?
        error_msg = 'keys required by the organizer but not found in the context: ' +
          arguments_not_included.join(', ')
        raise ExpectedKeyError, error_msg
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_service-1.2.6 lib/simple_service/commands/validates_expected_keys.rb
simple_service-1.2.5 lib/simple_service/commands/validates_expected_keys.rb