class Apigen::PrimaryType

PrimaryType represents a primary type such as a string or an integer.

Constants

PRIMARY_TYPES

Attributes

shape[R]

Public Class Methods

new(shape) click to toggle source
# File lib/apigen/models/primary_type.rb, line 17
def initialize(shape)
  @shape = shape
end
primary?(shape) click to toggle source
# File lib/apigen/models/primary_type.rb, line 11
def self.primary?(shape)
  PRIMARY_TYPES.include? shape
end

Public Instance Methods

==(other) click to toggle source
# File lib/apigen/models/primary_type.rb, line 25
def ==(other)
  other.is_a?(PrimaryType) && other.shape == shape
end
to_s() click to toggle source
# File lib/apigen/models/primary_type.rb, line 29
def to_s
  @shape.to_s
end
validate(_model_registry) click to toggle source
# File lib/apigen/models/primary_type.rb, line 21
def validate(_model_registry)
  raise "Unsupported primary type :#{@shape}." unless self.class.primary?(@shape)
end