Sha256: 163b400618252f3c0011d744cf1439a4c9cc8752994c9a58bce19d7353cd851f

Contents?: true

Size: 510 Bytes

Versions: 1

Compression:

Stored size: 510 Bytes

Contents

module Dry
  module Validation
    class Schema
      module Definition
        class Rule
          attr_reader :node

          def initialize(node)
            @node = node
          end

          def to_ary
            node
          end
          alias_method :to_a, :to_ary

          def &(other)
            self.class.new([:and, [node, other.to_ary]])
          end

          def |(other)
            self.class.new([:or, [node, other.to_ary]])
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-validation-0.1.0 lib/dry/validation/schema/rule.rb