Module: Hames::Schema::DSL
- Included in:
- Hames::Service
- Defined in:
- lib/hames/schema.rb
Overview
Class-level DSL. Hames::Service extends it so every service is schema-able;
a functional plugin (one that only responds to apply, not a Service) can
extend Hames::Schema::DSL to be schema'd too — that is how the OpenRouter
plugin, which is not a Service, still carries a schema doctor can read.
Instance Method Summary collapse
- #config_schema(specs = UNSET) ⇒ Object
-
#stored_config_schema ⇒ Object
Inherited like service_key and inject: a subclass that does not redeclare validates exactly like its parent.
Instance Method Details
#config_schema(specs = UNSET) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/hames/schema.rb', line 37 def config_schema(specs = UNSET) return stored_config_schema if specs.equal?(UNSET) @config_schema = Hames::Schema.build(specs) Hames::Schema.register(self, @config_schema) @config_schema end |
#stored_config_schema ⇒ Object
Inherited like service_key and inject: a subclass that does not redeclare validates exactly like its parent.
47 48 49 50 51 52 |
# File 'lib/hames/schema.rb', line 47 def stored_config_schema return @config_schema if defined?(@config_schema) && @config_schema parent = superclass if respond_to?(:superclass) parent.respond_to?(:config_schema) ? parent.config_schema : nil end |