Sha256: b390762a27f31cf1cd20bbab3e8841facc0d92ac8ee9c7d725a8ee433802ba39
Contents?: true
Size: 912 Bytes
Versions: 6
Compression:
Stored size: 912 Bytes
Contents
# frozen_string_literal: true module Dry module Types # Any is a nominal type that defines Object as the primitive class # # This type is useful in places where you can't be specific about the type # and anything is acceptable. # # @api public class AnyClass < Nominal def self.name 'Any' end # @api private def initialize(**options) super(::Object, **options) end # @return [String] # # @api public def name 'Any' end # @param [Hash] new_options # # @return [Type] # # @api public def with(**new_options) self.class.new(**options, meta: @meta, **new_options) end # @return [Array] # # @api public def to_ast(meta: true) [:any, meta ? self.meta : EMPTY_HASH] end end Any = AnyClass.new end end
Version data entries
6 entries across 6 versions & 2 rubygems