Class: Taipo::TypeElement::Constraints Private

Inherits:
Array
  • Object
show all
Defined in:
lib/taipo/type_element/constraints.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 Constraint objects

Since:

  • 1.4.0

Instance Method Summary collapse

Constructor Details

#initialize(constraints = nil) ⇒ Constraints

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::Constraint

Parameters:

Since:

  • 1.4.0



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

def initialize(constraints = nil)
  constraints&.each { |c| self.push c }
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
32
# File 'lib/taipo/type_element/constraints.rb', line 27

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