Sha256: 930a27d1c6c166b1186524c8a6108b16ad7a1e624245b1f7f15d6514240f65da
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module Dry module Schema module Messages # Namespaced messages backend # # @api public class Namespaced <Dry::Schema::Messages::Abstract # @api private attr_reader :namespace # @api private attr_reader :messages # @api private attr_reader :root # @api private def initialize(namespace, messages) super() @namespace = namespace @messages = messages @root = messages.root end # Get a message for the given key and its options # # @param [Symbol] key # @param [Hash] options # # @return [String] # # @api public def get(key, options = {}) messages.get(key, options) end # Check if given key is defined # # @return [Boolean] # # @api public def key?(key, *args) messages.key?(key, *args) end # @api private def lookup_paths(tokens) super(tokens.merge(root: "#{root}.rules.#{namespace}")) + super end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-schema-0.1.1 | lib/dry/schema/messages/namespaced.rb |
dry-schema-0.1.0 | lib/dry/schema/messages/namespaced.rb |