Module: YardTypes::OrList Private

Included in:
CollectionType, HashType
Defined in:
lib/yard_types/types.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#or_list(ary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


5
6
7
8
9
10
11
12
13
# File 'lib/yard_types/types.rb', line 5

def or_list(ary)
  size = ary.size
  ary.to_enum.with_index.inject('') do |acc, (s, index)|
    acc << s.to_s
    acc << ", "    if index < size - 2
    acc << ", or " if index == size - 2
    acc
  end
end