123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Thor::DynamicCommand

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Command, Struct
Instance Chain:
self, Command, Struct
Inherits: Bundler::Thor::Command
Defined in: lib/bundler/vendor/thor/lib/thor/command.rb

Overview

A dynamic command that handles method missing scenarios.

Constant Summary

Command - Inherited

FILE_REGEXP

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Command - Inherited

#formatted_usage

Returns the formatted usage by injecting given required arguments and required options into the given usage.

#run

By default, a command invokes a method in the thor class.

#handle_argument_error?, #handle_no_method_error?, #local_method?, #not_debugging?, #private_method?, #required_options, #initialize_copy,
#public_method?

Given a target, checks if this class name is a public method.

#sans_backtrace

Constructor Details

.new(name, options = nil) ⇒ DynamicCommand

[ GitHub ]

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

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 = [])

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/command.rb', line 126

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