Class: Taipo::TypeElements Private

Inherits:
Array
  • Object
show all
Defined in:
lib/taipo/type_elements.rb

Overview

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

A set of TypeElement objects

Since:

  • 1.4.0

Instance Method Summary collapse

Constructor Details

#initialize(els = nil) ⇒ TypeElements

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.

Initialize a new set of Taipo::TypeElement

Parameters:

Since:

  • 1.4.0



17
18
19
# File 'lib/taipo/type_elements.rb', line 17

def initialize(els = nil)
  els&.each { |el| self.push el }
end

Instance Method Details

#to_sString

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.

Return the String representation of this object

Returns:

  • (String)

    the representation as a String

Since:

  • 1.4.0



27
28
29
30
31
# File 'lib/taipo/type_elements.rb', line 27

def to_s
  self.reduce('') do |memo,el|
    (memo == '') ? el.to_s : memo + '|' + el.to_s
  end
end