Class: Bundler::Thor::DynamicCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/bundler/vendor/thor/lib/thor/command.rb

Overview

A dynamic command that handles method missing scenarios.

Constant Summary

Constants inherited from Command

Command::FILE_REGEXP

Instance Attribute Summary

Attributes inherited from Command

#description, #long_description, #name, #options, #usage

Instance Method Summary collapse

Methods inherited from Command

#formatted_usage, #hidden?, #initialize_copy

Constructor Details

#initialize(name, options = nil) ⇒ DynamicCommand

Returns a new instance of DynamicCommand.



120
121
122
# File 'lib/bundler/vendor/thor/lib/thor/command.rb', line 120

def initialize(name, options = nil)
  super(name.to_s, "A dynamically-generated command", name.to_s, name.to_s, options)
end

Instance Method Details

#run(instance, args = []) ⇒ Object



124
125
126
127
128
129
130
# File 'lib/bundler/vendor/thor/lib/thor/command.rb', line 124

def run(instance, args = [])
  if (instance.methods & [name.to_s, name.to_sym]).empty?
    super
  else
    instance.class.handle_no_command_error(name)
  end
end