class CryptoconditionsRuby::TypeRegistry
Constants
- MAX_SAFE_INTEGER_JS
Public Class Methods
get_class_from_type_id(type_id)
click to toggle source
# File lib/cryptoconditions_ruby/type_registry.rb, line 8 def self.get_class_from_type_id(type_id) if type_id > MAX_SAFE_INTEGER_JS raise TypeError.new("Type #{type_id} is not supported") end type = registered_types.find do |registered_type| type_id == registered_type['type_id'] end if type type['class'] else raise TypeError.new("Type #{type_id} is not supported") end end
register_type(cls)
click to toggle source
# File lib/cryptoconditions_ruby/type_registry.rb, line 24 def self.register_type(cls) registered_types.push({'type_id' => cls::TYPE_ID, 'class' => cls}) end
registered_types()
click to toggle source
# File lib/cryptoconditions_ruby/type_registry.rb, line 4 def self.registered_types @registered_types ||=[] end