class YARD::Tags::TypesExplainer::Type
@private
Attributes
Public Class Methods
Source
# File lib/yard/tags/types_explainer.rb, line 29 def initialize(name) @name = name end
Public Instance Methods
Source
# File lib/yard/tags/types_explainer.rb, line 33 def to_s(singular = true) if name[0, 1] == "#" singular ? "an object that responds to #{name}" : "objects that respond to #{name}" elsif 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
Private Instance Methods
Source
# File lib/yard/tags/types_explainer.rb, line 45 def list_join(list) index = 0 list.inject(String.new) do |acc, el| acc << el.to_s acc << ", " if index < list.size - 2 acc << " or " if index == list.size - 2 index += 1 acc end end