Class: Textus::Domain::Policy::PublishTarget
- Inherits:
-
Object
- Object
- Textus::Domain::Policy::PublishTarget
- Defined in:
- lib/textus/domain/policy/publish_target.rb
Overview
One publish destination (ADR 0094). Exactly one of:
to-target { to:, template:?, inject_boot:? } — render data through a
template, or copy verbatim when no template
tree-target { tree: } — ADR 0052 subtree mirror
Provenance is NOT a publish flag — it lives in the data’s ‘_meta`.
Instance Attribute Summary collapse
-
#inject_boot ⇒ Object
readonly
Returns the value of attribute inject_boot.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Instance Method Summary collapse
-
#initialize(raw) ⇒ PublishTarget
constructor
A new instance of PublishTarget.
- #renders? ⇒ Boolean
- #to_target? ⇒ Boolean
- #tree_target? ⇒ Boolean
Constructor Details
#initialize(raw) ⇒ PublishTarget
Returns a new instance of PublishTarget.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/textus/domain/policy/publish_target.rb', line 12 def initialize(raw) if raw.key?("provenance") raise Textus::BadManifest.new("publish `provenance:` was removed (ADR 0094): provenance lives in the data's `_meta`") end @to = raw["to"] @tree = raw["tree"] raise Textus::BadManifest.new("a publish target needs exactly one of `to:` or `tree:`") unless @to.nil? ^ @tree.nil? @template = raw["template"] @inject_boot = raw["inject_boot"] == true return unless tree_target? && (@template || @inject_boot) raise Textus::BadManifest.new("a tree target takes no template/inject_boot (ADR 0094)") end |
Instance Attribute Details
#inject_boot ⇒ Object (readonly)
Returns the value of attribute inject_boot.
10 11 12 |
# File 'lib/textus/domain/policy/publish_target.rb', line 10 def inject_boot @inject_boot end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
10 11 12 |
# File 'lib/textus/domain/policy/publish_target.rb', line 10 def template @template end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
10 11 12 |
# File 'lib/textus/domain/policy/publish_target.rb', line 10 def to @to end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
10 11 12 |
# File 'lib/textus/domain/policy/publish_target.rb', line 10 def tree @tree end |
Instance Method Details
#renders? ⇒ Boolean
30 |
# File 'lib/textus/domain/policy/publish_target.rb', line 30 def renders? = to_target? && !@template.nil? |
#to_target? ⇒ Boolean
28 |
# File 'lib/textus/domain/policy/publish_target.rb', line 28 def to_target? = !@to.nil? |
#tree_target? ⇒ Boolean
29 |
# File 'lib/textus/domain/policy/publish_target.rb', line 29 def tree_target? = !@tree.nil? |