Class: RubyCoded::Commands::CommandDefinition
- Inherits:
-
Object
- Object
- RubyCoded::Commands::CommandDefinition
- Defined in:
- lib/ruby_coded/commands/command_definition.rb
Overview
Normalized command metadata shared by core, plugin, and markdown commands.
Constant Summary collapse
- ATTRIBUTES =
%i[name description handler source usage content path].freeze
Instance Method Summary collapse
- #executable? ⇒ Boolean
-
#initialize(**attrs) ⇒ CommandDefinition
constructor
A new instance of CommandDefinition.
- #markdown? ⇒ Boolean
Constructor Details
#initialize(**attrs) ⇒ CommandDefinition
Returns a new instance of CommandDefinition.
11 12 13 |
# File 'lib/ruby_coded/commands/command_definition.rb', line 11 def initialize(**attrs) ATTRIBUTES.each { |name| instance_variable_set(ivar(name), attrs[name]) } end |
Instance Method Details
#executable? ⇒ Boolean
19 20 21 |
# File 'lib/ruby_coded/commands/command_definition.rb', line 19 def executable? !@handler.nil? || markdown? end |
#markdown? ⇒ Boolean
15 16 17 |
# File 'lib/ruby_coded/commands/command_definition.rb', line 15 def markdown? @source == :markdown end |