Sha256: ff766073d58d2bcf0a082fddec63036cb334fec65aeb4b56f28de106b65b4670
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true require 'dry-types' require 'dry/types/core' require 'pathname' module Dry module Types def self.register_if_needed(key, value) register(key, value) unless registered?(key) end def self.Pathname(path) path.is_a?(Pathname) ? path : Kernel::Pathname(path.to_s) end register_if_needed 'pathname', simple = Definition[Pathname].new(Pathname) register_if_needed 'strict.pathname', strict = simple.constrained(type: Pathname) register_if_needed 'coercible.pathname', coercible = simple.constructor(method(:Pathname)) register_if_needed 'optional.pathname', simple.optional register_if_needed 'optional.strict.pathname', strict.optional register_if_needed 'optional.coercible.pathname', coercible.optional end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-files-0.2.0 | lib/dry/types/pathname.rb |