Sha256: b2778c64e386615ef7dc33c17c25bb8fec7434d3d0d7495d8b7d238c981bb49f
Contents?: true
Size: 864 Bytes
Versions: 3
Compression:
Stored size: 864 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" # @api private def initialize(**options) super(::Object, **options) end # @return [String] # # @api public def name = "Any" # @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 Any = AnyClass.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-types-1.8.2 | lib/dry/types/any.rb |
dry-types-1.8.1 | lib/dry/types/any.rb |
dry-types-1.8.0 | lib/dry/types/any.rb |