Class: WhatTheGem::Command
Defined Under Namespace
Classes: Meta
Constant Summary collapse
- HEADER_TEMPLATE =
FIXME: It was > **info.info | paragraphs:1 }** but it looks weird due to tty-markdown bug: github.com/piotrmurach/tty-markdown/issues/11
Template.parse(<<~HEADER) # {{info.name}} > {{info.info | paragraphs:1 | reflow }} > ({{uris | join:", "}}) ## {{title}} HEADER
Class Attribute Summary collapse
-
.meta ⇒ Object
readonly
Returns the value of attribute meta.
Instance Attribute Summary collapse
-
#gem ⇒ Object
readonly
Returns the value of attribute gem.
Class Method Summary collapse
- .call(*args) ⇒ Object
- .get(handle) ⇒ Object
- .register(title: name.split('::').last, handle: title.downcase, description:) ⇒ Object
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(gem) ⇒ Command
constructor
A new instance of Command.
- #meta ⇒ Object
Constructor Details
#initialize(gem) ⇒ Command
Returns a new instance of Command.
51 52 53 |
# File 'lib/whatthegem/commands.rb', line 51 def initialize(gem) @gem = gem end |
Class Attribute Details
.meta ⇒ Object (readonly)
Returns the value of attribute meta.
13 14 15 |
# File 'lib/whatthegem/commands.rb', line 13 def @meta end |
Instance Attribute Details
#gem ⇒ Object (readonly)
Returns the value of attribute gem.
49 50 51 |
# File 'lib/whatthegem/commands.rb', line 49 def gem @gem end |
Class Method Details
.call(*args) ⇒ Object
28 29 30 |
# File 'lib/whatthegem/commands.rb', line 28 def call(*args) new(*args).call end |
.get(handle) ⇒ Object
24 25 26 |
# File 'lib/whatthegem/commands.rb', line 24 def get(handle) Command.registry[handle] end |
.register(title: name.split('::').last, handle: title.downcase, description:) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/whatthegem/commands.rb', line 15 def register(title: name.split('::').last, handle: title.downcase, description:) Command.registry[handle] = self @meta = Meta.new( handle: handle, title: title, description: description ) end |