Method: Thor::Shell#initialize

Defined in:
lib/thor/shell.rb

#initialize(args = [], options = {}, config = {}) ⇒ Object

Add shell to initialize config values.

Configuration

shell<Object>

An instance of the shell to be used.

Examples

class MyScript < Thor
  argument :first, :type => :numeric
end

MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new

44
45
46
47
48
# File 'lib/thor/shell.rb', line 44

def initialize(args = [], options = {}, config = {})
  super
  self.shell = config[:shell]
  shell.base ||= self if shell.respond_to?(:base)
end