Class: YARD::Tags::TypesExplainer::HashCollectionType

Inherits:
Type
  • Object
show all
Defined in:
lib/yard/tags/types_explainer.rb

Instance Attribute Summary collapse

Attributes inherited from Type

#name

Instance Method Summary collapse

Constructor Details

#initialize(name, key_types, value_types) ⇒ HashCollectionType

Returns a new instance of HashCollectionType.



82
83
84
85
86
# File 'lib/yard/tags/types_explainer.rb', line 82

def initialize(name, key_types, value_types)
  @name = name
  @key_types = key_types
  @value_types = value_types
end

Instance Attribute Details

#key_typesObject

Returns the value of attribute key_types.



80
81
82
# File 'lib/yard/tags/types_explainer.rb', line 80

def key_types
  @key_types
end

#value_typesObject

Returns the value of attribute value_types.



80
81
82
# File 'lib/yard/tags/types_explainer.rb', line 80

def value_types
  @value_types
end

Instance Method Details

#to_s(_singular = true) ⇒ Object



88
89
90
91
92
# File 'lib/yard/tags/types_explainer.rb', line 88

def to_s(_singular = true)
  "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} with keys made of (" +
    list_join(key_types.map {|t| t.to_s(false) }) +
    ") and values of (" + list_join(value_types.map {|t| t.to_s(false) }) + ")"
end