123456789_123456789_123456789_123456789_123456789_

Class: YARD::Tags::TypesExplainer::Type Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
YARD::Tags::TypesExplainer::CollectionType, YARD::Tags::TypesExplainer::FixedCollectionType, YARD::Tags::TypesExplainer::HashCollectionType
Inherits: Object
Defined in: lib/yard/tags/types_explainer.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#name (rw)

[ GitHub ]

  
# File 'lib/yard/tags/types_explainer.rb', line 27

attr_accessor :name

Instance Method Details

#list_join(list) (private)

[ GitHub ]

  
# 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

#to_s(singular = true)

[ GitHub ]

  
# 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