Sha256: 39e80af62553888d224fdd3e188c2fc2d06bbe767898eadbb31d1bee5a7e3d43

Contents?: true

Size: 608 Bytes

Versions: 6

Compression:

Stored size: 608 Bytes

Contents

module Dry
  module Validation
    module Messages
      class Namespaced < Messages::Abstract
        attr_reader :namespace, :messages, :root

        def initialize(namespace, messages)
          @namespace = namespace
          @messages = messages
          @root = messages.root
        end

        def key?(key, *args)
          messages.key?(key, *args)
        end

        def get(key, options = {})
          messages.get(key, options)
        end

        def lookup_paths(tokens)
          super(tokens.merge(root: "#{root}.rules.#{namespace}")) + super
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.6.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.5.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.4.1 lib/dry/validation/messages/namespaced.rb
dry-validation-0.4.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.3.1 lib/dry/validation/messages/namespaced.rb
dry-validation-0.3.0 lib/dry/validation/messages/namespaced.rb