Class: Textus::Action::Base

Inherits:
Object
  • Object
show all
Extended by:
Contract::DSL
Defined in:
lib/textus/action/base.rb

Class Method Summary collapse

Methods included from Contract::DSL

arg, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view

Class Method Details

.callObject

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/textus/action/base.rb', line 31

def self.call(**)
  raise NotImplementedError.new("#{name}.call")
end

.inherited(subclass) ⇒ Object



26
27
28
29
# File 'lib/textus/action/base.rb', line 26

def self.inherited(subclass)
  super
  Textus::Action.register(subclass) if subclass.name
end

.proposal_from(env, key:) ⇒ Object



35
36
37
38
39
# File 'lib/textus/action/base.rb', line 35

def self.proposal_from(env, key:)
  proposal = env.meta&.dig("proposal") or return Failure(code: :proposal_error, message: "entry has no proposal block: #{key}")
  target = proposal["target_key"] or return Failure(code: :proposal_error, message: "proposal missing target_key")
  { proposal:, target_key: target }
end