Class: Textus::VerbRegistry::VerbSpec
- Inherits:
-
Data
- Object
- Data
- Textus::VerbRegistry::VerbSpec
- Defined in:
- lib/textus/verb_registry.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#cli_stdin ⇒ Object
readonly
Returns the value of attribute cli_stdin.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#surfaces ⇒ Object
readonly
Returns the value of attribute surfaces.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Instance Method Summary collapse
- #cli? ⇒ Boolean
- #cli_group ⇒ Object
- #cli_leaf ⇒ Object
- #cli_path ⇒ Object
- #cli_words ⇒ Object
- #input_schema ⇒ Object
- #maintenance? ⇒ Boolean
- #mcp? ⇒ Boolean
- #read? ⇒ Boolean
- #required_args ⇒ Object
- #view(surface = :default) ⇒ Object
- #write? ⇒ Boolean
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def args @args end |
#category ⇒ Object (readonly)
Returns the value of attribute category
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def category @category end |
#cli ⇒ Object (readonly)
Returns the value of attribute cli
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def cli @cli end |
#cli_stdin ⇒ Object (readonly)
Returns the value of attribute cli_stdin
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def cli_stdin @cli_stdin end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def summary @summary end |
#surfaces ⇒ Object (readonly)
Returns the value of attribute surfaces
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def surfaces @surfaces end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def verb @verb end |
#views ⇒ Object (readonly)
Returns the value of attribute views
24 25 26 |
# File 'lib/textus/verb_registry.rb', line 24 def views @views end |
Instance Method Details
#cli? ⇒ Boolean
26 |
# File 'lib/textus/verb_registry.rb', line 26 def cli? = surfaces.include?(:cli) |
#cli_group ⇒ Object
30 |
# File 'lib/textus/verb_registry.rb', line 30 def cli_group = cli_words.size > 1 ? cli_words.first : nil |
#cli_leaf ⇒ Object
31 |
# File 'lib/textus/verb_registry.rb', line 31 def cli_leaf = cli_words.last |
#cli_path ⇒ Object
28 |
# File 'lib/textus/verb_registry.rb', line 28 def cli_path = cli || verb.to_s |
#cli_words ⇒ Object
29 |
# File 'lib/textus/verb_registry.rb', line 29 def cli_words = cli_path.split |
#input_schema ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/textus/verb_registry.rb', line 37 def input_schema props = args.to_h do |a| json_type = VerbRegistry::TYPE_MAP[a.type] || "string" h = { "type" => json_type } h["description"] = a.description if a.description [a.wire.to_s, h] end { type: "object", properties: props, required: required_args.map { |a| a.wire.to_s } } end |
#maintenance? ⇒ Boolean
35 |
# File 'lib/textus/verb_registry.rb', line 35 def maintenance? = category == :maintenance |
#mcp? ⇒ Boolean
25 |
# File 'lib/textus/verb_registry.rb', line 25 def mcp? = surfaces.include?(:mcp) |
#read? ⇒ Boolean
33 |
# File 'lib/textus/verb_registry.rb', line 33 def read? = category == :read |
#required_args ⇒ Object
32 |
# File 'lib/textus/verb_registry.rb', line 32 def required_args = args.select(&:required) |
#view(surface = :default) ⇒ Object
27 |
# File 'lib/textus/verb_registry.rb', line 27 def view(surface = :default) = views[surface] || views.fetch(:default) |
#write? ⇒ Boolean
34 |
# File 'lib/textus/verb_registry.rb', line 34 def write? = category == :write |