Class: YARD::Tags::TypesExplainer::Type
- Inherits:
-
Object
- Object
- YARD::Tags::TypesExplainer::Type
- Defined in:
- lib/yard/tags/types_explainer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Type
constructor
A new instance of Type.
- #to_s(singular = true) ⇒ Object
Constructor Details
#initialize(name) ⇒ Type
Returns a new instance of Type.
29 30 31 |
# File 'lib/yard/tags/types_explainer.rb', line 29 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
27 28 29 |
# File 'lib/yard/tags/types_explainer.rb', line 27 def name @name end |
Instance Method Details
#to_s(singular = true) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# 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 |