Class: ScaleRb::Types::Base

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/scale_rb/types.rb

Constant Summary collapse

MAX_DEPTH =
2

Instance Method Summary collapse

Instance Method Details

#t(type_id) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/scale_rb/types.rb', line 31

def t(type_id)
  raise 'No registry' unless registry

  pt = registry[type_id]
  raise "Unknown type: #{type_id}" unless pt

  pt
end

#to_sObject



40
41
42
# File 'lib/scale_rb/types.rb', line 40

def to_s
  to_string
end

#to_string(_depth = 0) ⇒ Object

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/scale_rb/types.rb', line 45

def to_string(_depth = 0)
  raise NotImplementedError, "#{self.class} must implement to_string"
end