Class: Textus::Action::Propose
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/action/propose.rb
Constant Summary collapse
- BURN =
:sync
Instance Method Summary collapse
- #call(container:, call:) ⇒ Object
-
#initialize(key:, meta: nil, body: nil, content: nil) ⇒ Propose
constructor
A new instance of Propose.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view
Methods inherited from Base
Constructor Details
#initialize(key:, meta: nil, body: nil, content: nil) ⇒ Propose
Returns a new instance of Propose.
24 25 26 27 28 29 30 |
# File 'lib/textus/action/propose.rb', line 24 def initialize(key:, meta: nil, body: nil, content: nil) super() @key = key @meta = @body = body @content = content end |
Instance Method Details
#call(container:, call:) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/textus/action/propose.rb', line 32 def call(container:, call:) zone = container.manifest.policy.propose_lane_for(call.role) unless zone raise Textus::Error.new( "propose_forbidden", "role '#{call.role}' has no writable propose_lane", details: { "role" => call.role }, hint: "the manifest must define a queue zone and '#{call.role}' must hold the 'propose' capability", ) end run_with_cascade("#{zone}.#{@key}", container:, call:) do Textus::Action::Put.new( key: "#{zone}.#{@key}", meta: @meta || {}, body: @body, content: @content, ).call(container: container, call: call) end end |