Class: Textus::Call
- Inherits:
-
Data
- Object
- Data
- Textus::Call
- Defined in:
- lib/textus/call.rb
Overview
Immutable per-invocation value. Carries who is acting (role), the request correlation id, the wall clock, and the dry_run flag — the bits Use Cases need that are not part of the Container.
Instance Attribute Summary collapse
-
#correlation_id ⇒ Object
readonly
Returns the value of attribute correlation_id.
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#now ⇒ Object
readonly
Returns the value of attribute now.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#correlation_id ⇒ Object (readonly)
Returns the value of attribute correlation_id
7 8 9 |
# File 'lib/textus/call.rb', line 7 def correlation_id @correlation_id end |
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run
7 8 9 |
# File 'lib/textus/call.rb', line 7 def dry_run @dry_run end |
#now ⇒ Object (readonly)
Returns the value of attribute now
7 8 9 |
# File 'lib/textus/call.rb', line 7 def now @now end |
#role ⇒ Object (readonly)
Returns the value of attribute role
7 8 9 |
# File 'lib/textus/call.rb', line 7 def role @role end |
Class Method Details
.build(role:, correlation_id: nil, now: nil, dry_run: false) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/textus/call.rb', line 8 def self.build(role:, correlation_id: nil, now: nil, dry_run: false) new( role: role.to_s, correlation_id: correlation_id || SecureRandom.uuid, now: now || Textus::Ports::Clock.now, dry_run: dry_run, ) end |
Instance Method Details
#dry_run? ⇒ Boolean
17 |
# File 'lib/textus/call.rb', line 17 def dry_run? = dry_run |
#with_role(new_role) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/textus/call.rb', line 19 def with_role(new_role) self.class.new( role: new_role.to_s, correlation_id: correlation_id, now: now, dry_run: dry_run, ) end |