Class: Textus::Manifest::Entry::Base::PublishContext

Inherits:
Data
  • Object
show all
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/Hooks::Context construction is cheap.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#callObject (readonly)

Returns the value of attribute call

Returns:

  • (Object)

    the current value of call



47
48
49
# File 'lib/textus/manifest/entry/base.rb', line 47

def call
  @call
end

#containerObject (readonly)

Returns the value of attribute container

Returns:

  • (Object)

    the current value of container



47
48
49
# File 'lib/textus/manifest/entry/base.rb', line 47

def container
  @container
end

#readerObject (readonly)

Returns the value of attribute reader

Returns:

  • (Object)

    the current value of reader



47
48
49
# File 'lib/textus/manifest/entry/base.rb', line 47

def reader
  @reader
end

Instance Method Details

#emit(event, **payload) ⇒ Object



57
58
59
# File 'lib/textus/manifest/entry/base.rb', line 57

def emit(event, **payload)
  events.publish(event, ctx: hook_context, **payload)
end

#eventsObject



51
# File 'lib/textus/manifest/entry/base.rb', line 51

def events     = container.events

#hook_contextObject



53
54
55
# File 'lib/textus/manifest/entry/base.rb', line 53

def hook_context
  Textus::Hooks::Context.new(scope: scope_for_hooks)
end

#manifestObject



48
# File 'lib/textus/manifest/entry/base.rb', line 48

def manifest   = container.manifest

#repo_rootObject



50
# File 'lib/textus/manifest/entry/base.rb', line 50

def repo_root  = File.dirname(container.root)

#rootObject



49
# File 'lib/textus/manifest/entry/base.rb', line 49

def root       = container.root