123456789_123456789_123456789_123456789_123456789_

Module: Bundler::Thor::Shell

Constant Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#shell (rw)

Holds the shell for the given ::Bundler::Thor instance. If no shell is given, it gets a default shell from Base.shell.

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/shell.rb', line 52

def shell
  @shell ||= Bundler::Thor::Base.shell.new
end

#shell=(value) (rw)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/shell.rb', line 25

attr_writer :shell

Instance Method Details

#_shared_configuration (protected)

This method is for internal use only.

Allow shell to be shared between invocations.

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/shell.rb', line 77

def _shared_configuration #:nodoc:
  super.merge!(:shell => shell)
end

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

Add shell to initialize config values.

Configuration

shell<Object>

An instance of the shell to be used.

Examples

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

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

  
# File 'lib/bundler/vendor/thor/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

#with_padding

Yields the given block with padding.

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/shell.rb', line 66

def with_padding
  shell.padding += 1
  yield
ensure
  shell.padding -= 1
end