Class: Textus::Entry::Base
- Inherits:
-
Object
- Object
- Textus::Entry::Base
show all
- Defined in:
- lib/textus/entry/base.rb
Overview
Abstract base for entry format strategies. Each concrete strategy owns parsing, serialization, file-extension claims, and schema validation for entries declared with its format.
Class Method Summary
collapse
Class Method Details
.extensions ⇒ Object
19
20
21
|
# File 'lib/textus/entry/base.rb', line 19
def self.extensions
raise NotImplementedError.new("#{name}.extensions not implemented")
end
|
.parse(_raw, path: nil) ⇒ Object
7
8
9
10
|
# File 'lib/textus/entry/base.rb', line 7
def self.parse(_raw, path: nil)
_ = path
raise NotImplementedError.new("#{name}.parse not implemented")
end
|
.serialize(meta: {}, body: "", content: nil) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/textus/entry/base.rb', line 12
def self.serialize(meta: {}, body: "", content: nil)
_ = meta
_ = body
_ = content
raise NotImplementedError.new("#{name}.serialize not implemented")
end
|
.validate_against(schema, parsed) ⇒ Object
Default: validate the meta hash. Overridden by formats that put the validatable payload elsewhere (json/yaml put it under “content”).
25
26
27
|
# File 'lib/textus/entry/base.rb', line 25
def self.validate_against(schema, parsed)
schema.validate!(parsed["_meta"] || {})
end
|