class Taipo::TypeElement::Constraints

A set of {Taipo::TypeElement::Constraint} objects

@since 1.4.0 @api private

Public Class Methods

new(constraints = nil) click to toggle source

Initialize a new set of {Taipo::TypeElement::Constraint}

@param constraints [Array<Taipo::TypeElement::Constraint>] the

constraints

@since 1.4.0 @api private

# File lib/taipo/type_element/constraints.rb, line 17
def initialize(constraints = nil)
  constraints&.each { |c| self.push c }
end

Public Instance Methods

to_s() click to toggle source

Return the String representation of this object

@return [String] the representation as a String

@since 1.4.0 @api private

# 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