Class: Dry::Types::Printer Private
- Inherits:
-
Object
- Object
- Dry::Types::Printer
- Defined in:
- lib/dry/types/tuple.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #visit_tuple(tuple) ⇒ Object private
Instance Method Details
#visit_tuple(tuple) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/dry/types/tuple.rb', line 206 def visit_tuple(tuple) = tuple..dup size = tuple.fixed_types.size size += 1 unless tuple.rest_type.nil? types = .delete(:types_index) (, tuple.) do |opts| header = "Tuple<" rest = visit(types.default) { |type| "*: #{type}" } if types.default if size.zero? yield "#{header}>#{opts}" else yield header.dup << (types.map { |pos, pos_type| visit(pos_type) { |type| "#{pos}: #{type}" } } << rest).compact.join(", ") << ">#{opts}" end end end |