module Bundler::Thor::Shell

Constants

SHELL_DELEGATED_METHODS

Attributes

shell[W]

Public Class Methods

new(args = [], options = {}, config = {}) Show source
# 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

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
Calls superclass method

Public Instance Methods

shell() Show source
# File lib/bundler/vendor/thor/lib/thor/shell.rb, line 52
def shell
  @shell ||= Bundler::Thor::Base.shell.new
end

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

with_padding() { || ... } Show source
# File lib/bundler/vendor/thor/lib/thor/shell.rb, line 66
def with_padding
  shell.padding += 1
  yield
ensure
  shell.padding -= 1
end

Yields the given block with padding.

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.