class YARD::Tags::TypesExplainer::Type
@private
Attributes
Public Class Methods
Source
# File lib/yard/tags/types_explainer.rb, line 32 def initialize(name) @name = name end
Public Instance Methods
Source
# File lib/yard/tags/types_explainer.rb, line 36 def to_s(singular = true) if name[0, 1] =~ /[A-Z]/ singular ? "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} " + name : "#{name}#{name[-1, 1] =~ /[A-Z]/ ? "'" : ''}s" else name end end
Protected Instance Methods
Source
# File lib/yard/tags/types_explainer.rb, line 46 def list_join(list, with: "or") index = 0 list.inject(String.new) do |acc, el| acc << el.to_s acc << ", " if index < list.size - 2 acc << " #{with} " if index == list.size - 2 index += 1 acc end end