class YARD::Tags::TypesExplainer::IntersectionType
@private
Attributes
Public Class Methods
Source
# File lib/yard/tags/types_explainer.rb, line 81 def initialize(types) @types = types end
Public Instance Methods
Source
# File lib/yard/tags/types_explainer.rb, line 85 def to_s(singular = true) # A leading "both"/"all of" disambiguates a single value # satisfying every listed type from what "a Foo and a Bar" alone # could otherwise read as - two separate things. prefix = types.size == 2 ? "both " : "all of " prefix + list_join(types.map {|t| t.to_s(singular) }, with: "and") end