Class: Yarrow::Schema::ValueType
- Inherits:
-
Struct
- Object
- Struct
- Yarrow::Schema::ValueType
- Defined in:
- lib/yarrow/schema/value.rb
Class Method Summary collapse
-
.inherited(subclass) ⇒ Object
Automatically register when struct is defined as a class extension rather than anonymous struct class.
- .register(label) ⇒ Object
Class Method Details
.inherited(subclass) ⇒ Object
Automatically register when struct is defined as a class extension rather than anonymous struct class.
12 13 14 15 16 |
# File 'lib/yarrow/schema/value.rb', line 12 def self.inherited(subclass) if subclass.name self.register(subclass.name.downcase.to_sym) end end |
.register(label) ⇒ Object
4 5 6 7 8 |
# File 'lib/yarrow/schema/value.rb', line 4 def self.register(label) class_type = Yarrow::Schema::Types::Instance.of(self).accept(Hash) Yarrow::Schema::Definitions.register(label, class_type) self end |