Sha256: 12f080bf432098aacc7bece8d5bca10c8f631c22c0b02be8cb8081ffc4cac7d6

Contents?: true

Size: 700 Bytes

Versions: 12

Compression:

Stored size: 700 Bytes

Contents

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

        def initialize(namespace, messages)
          super()
          @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

        def default_locale
          messages.default_locale
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dry-validation-0.13.2 lib/dry/validation/messages/namespaced.rb
dry-validation-0.13.1 lib/dry/validation/messages/namespaced.rb
dry-validation-0.11.2 lib/dry/validation/messages/namespaced.rb
dry-validation-0.12.3 lib/dry/validation/messages/namespaced.rb
dry-validation-0.13.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.12.2 lib/dry/validation/messages/namespaced.rb
dry-validation-0.12.1 lib/dry/validation/messages/namespaced.rb
dry-validation-0.12.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.11.1 lib/dry/validation/messages/namespaced.rb
dry-validation-0.11.0 lib/dry/validation/messages/namespaced.rb
dry-validation-0.10.7 lib/dry/validation/messages/namespaced.rb
dry-validation-0.10.6 lib/dry/validation/messages/namespaced.rb