Sha256: 61803376c14dac57ac2ad671239b2d84e9d750b92a727203c3c0e2fcaa3036eb
Contents?: true
Size: 912 Bytes
Versions: 7
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
7 entries across 7 versions & 1 rubygems