Class: Textus::Manifest::Entry::Base::PublishContext
- Inherits:
-
Data
- Object
- Data
- Textus::Manifest::Entry::Base::PublishContext
- Defined in:
- lib/textus/manifest/entry/base.rb
Overview
Minimal context object passed into entry ‘publish_via` hooks. Everything beyond the three primitives is derived. Data.define instances are frozen, so we recompute per-call rather than memoizing — RoleScope/Step::Context construction is cheap.
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#reader ⇒ Object
readonly
Returns the value of attribute reader.
Instance Method Summary collapse
- #emit(event, **payload) ⇒ Object
- #hook_context ⇒ Object
- #manifest ⇒ Object
-
#read_template(name) ⇒ Object
Read a named template from the store’s templates/ directory.
- #repo_root ⇒ Object
- #root ⇒ Object
- #steps ⇒ Object
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call
68 69 70 |
# File 'lib/textus/manifest/entry/base.rb', line 68 def call @call end |
#container ⇒ Object (readonly)
Returns the value of attribute container
68 69 70 |
# File 'lib/textus/manifest/entry/base.rb', line 68 def container @container end |
#reader ⇒ Object (readonly)
Returns the value of attribute reader
68 69 70 |
# File 'lib/textus/manifest/entry/base.rb', line 68 def reader @reader end |
Instance Method Details
#emit(event, **payload) ⇒ Object
78 79 80 |
# File 'lib/textus/manifest/entry/base.rb', line 78 def emit(event, **payload) steps.publish(event, ctx: hook_context, **payload) end |
#hook_context ⇒ Object
74 75 76 |
# File 'lib/textus/manifest/entry/base.rb', line 74 def hook_context Textus::Step::Context.new(scope: scope_for_hooks) end |
#manifest ⇒ Object
69 |
# File 'lib/textus/manifest/entry/base.rb', line 69 def manifest = container.manifest |
#read_template(name) ⇒ Object
Read a named template from the store’s templates/ directory. Raises TemplateError when the file doesn’t exist.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/textus/manifest/entry/base.rb', line 84 def read_template(name) path = File.join(container.root.to_s, "templates", name) unless File.exist?(path) raise Textus::TemplateError.new( "template '#{name}' not found", template_name: name, ) end File.read(path) end |
#repo_root ⇒ Object
71 |
# File 'lib/textus/manifest/entry/base.rb', line 71 def repo_root = File.dirname(container.root) |
#root ⇒ Object
70 |
# File 'lib/textus/manifest/entry/base.rb', line 70 def root = container.root |
#steps ⇒ Object
72 |
# File 'lib/textus/manifest/entry/base.rb', line 72 def steps = container.steps |