Class: Textus::Contract::Arg
- Inherits:
-
Data
- Object
- Data
- Textus::Contract::Arg
- Defined in:
- lib/textus/contract.rb
Overview
One argument of a verb. ‘positional: true` means it is passed to the use-case as a positional (e.g. `get(key)`); otherwise as a keyword. `session_default` names a zero-arg method on `Textus::Session` (Symbol) that supplies the value when the wire arg is absent; `nil` means no default. `wire_name` is the name the arg carries on the wire (MCP JSON property / CLI envelope key) when it must differ from the use-case kwarg `name` — e.g. `put` takes the `meta:` kwarg but exposes `_meta` on the wire to match what `get` returns and what the CLI `–stdin` envelope already speaks (ADR 0057). `source: :file` (CLI only) reads the arg’s value as a path -> file contents; ‘coerce:` is a callable applied to the raw value (CLI only); `cli_default:` supplies a CLI-specific default that diverges from the contract `default` the agent surfaces use (`:__unset` sentinel = none).
Instance Attribute Summary collapse
-
#cli_default ⇒ Object
readonly
Returns the value of attribute cli_default.
-
#coerce ⇒ Object
readonly
Returns the value of attribute coerce.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#positional ⇒ Object
readonly
Returns the value of attribute positional.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#session_default ⇒ Object
readonly
Returns the value of attribute session_default.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#wire_name ⇒ Object
readonly
Returns the value of attribute wire_name.
Instance Method Summary collapse
-
#wire ⇒ Object
The name used on the wire (defaults to the kwarg name).
Instance Attribute Details
#cli_default ⇒ Object (readonly)
Returns the value of attribute cli_default
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def cli_default @cli_default end |
#coerce ⇒ Object (readonly)
Returns the value of attribute coerce
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def coerce @coerce end |
#default ⇒ Object (readonly)
Returns the value of attribute default
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def default @default end |
#description ⇒ Object (readonly)
Returns the value of attribute description
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def name @name end |
#positional ⇒ Object (readonly)
Returns the value of attribute positional
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def positional @positional end |
#required ⇒ Object (readonly)
Returns the value of attribute required
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def required @required end |
#session_default ⇒ Object (readonly)
Returns the value of attribute session_default
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def session_default @session_default end |
#source ⇒ Object (readonly)
Returns the value of attribute source
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def source @source end |
#type ⇒ Object (readonly)
Returns the value of attribute type
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def type @type end |
#wire_name ⇒ Object (readonly)
Returns the value of attribute wire_name
19 20 21 |
# File 'lib/textus/contract.rb', line 19 def wire_name @wire_name end |
Instance Method Details
#wire ⇒ Object
The name used on the wire (defaults to the kwarg name).
24 |
# File 'lib/textus/contract.rb', line 24 def wire = wire_name || name |