Sha256: 35010e0bbd1078133f02be6ce96bcff900318cc94bc300f951cc77c30178887f
Contents?: true
Size: 958 Bytes
Versions: 38
Compression:
Stored size: 958 Bytes
Contents
# frozen_string_literal: true module Dry module Schema # A special rule type that is configured under a specified namespace # # This is used internally to create rules that can be properly handled # by the message compiler in situations where a schema reuses another schema # but it is configured to use a message namespace # # @api private class NamespacedRule # @api private attr_reader :rule # @api private attr_reader :namespace # @api private def initialize(namespace, rule) @namespace = namespace @rule = rule end # @api private def call(input) result = rule.call(input) Logic::Result.new(result.success?) { [:namespace, [namespace, result.to_ast]] } end # @api private def ast(input = Undefined) [:namespace, [namespace, rule.ast(input)]] end alias_method :to_ast, :ast end end end
Version data entries
38 entries across 38 versions & 1 rubygems