HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Ruby27-x64/share/ri/2.7.0/system/Bundler/Thor/Invocation/invoke-i.ri
U:RDoc::AnyMethod[iI"invoke:ETI"%Bundler::Thor::Invocation#invoke;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph;	[I"SReceives a name and invokes it. The name can be a string (either "command" or ;TI"a"namespace:command"), a Bundler::Thor::Command, a Class or a Bundler::Thor instance. If the ;TI"Scommand cannot be guessed by name, it can also be supplied as second argument.;To:RDoc::Markup::BlankLineo;
;	[I"MYou can also supply the arguments, options and configuration values for ;TI"Jthe command to be invoked, if none is given, the same values used to ;TI"?initialize the invoker are used to initialize the invoked.;T@o;
;	[I"TWhen no name is given, it will invoke the default command of the current class.;T@S:RDoc::Markup::Heading:
leveli	:	textI"
Examples;T@o:RDoc::Markup::Verbatim;	[I"class A < Bundler::Thor
;TI"  def foo
;TI"    invoke :bar
;TI"$    invoke "b:hello", ["Erik"]
;TI"  end
;TI"
;TI"  def bar
;TI"$    invoke "b:hello", ["Erik"]
;TI"  end
;TI"	end
;TI"
;TI"class B < Bundler::Thor
;TI"  def hello(name)
;TI"    puts "hello #{name}"
;TI"  end
;TI"	end
;T:@format0o;
;	[I"MYou can notice that the method "foo" above invokes two commands: "bar", ;TI"Nwhich belongs to the same class and "hello" which belongs to the class B.;T@o;
;	[I"SBy using an invocation system you ensure that a command is invoked only once. ;TI"PIn the example above, invoking "foo" will invoke "b:hello" just once, even ;TI"+if it's invoked later by "bar" method.;T@o;
;	[I"NWhen class A invokes class B, all arguments used on A initialization are ;TI"Nsupplied to B. This allows lazy parse of options. Let's suppose you have ;TI"some rspec commands:;T@o;;	[I"(class Rspec < Bundler::Thor::Group
;TI"G  class_option :mock_framework, :type => :string, :default => :rr
;TI"
;TI"!  def invoke_mock_framework
;TI"4    invoke "rspec:#{options[:mock_framework]}"
;TI"  end
;TI"	end
;T;0o;
;	[I"OAs you noticed, it invokes the given mock framework, which might have its ;TI"own options:;T@o;;	[I",class Rspec::RR < Bundler::Thor::Group
;TI"@  class_option :style, :type => :string, :default => :mock
;TI"	end
;T;0o;
;	[I"KSince it's not rspec concern to parse mock framework options, when RR ;TI"Qis invoked all options are parsed again, so RR can extract only the options ;TI"that it's going to use.;T@o;
;	[I"NIf you want Rspec::RR to be initialized with its own set of options, you ;TI" have to do that explicitly:;T@o;;	[I"+invoke "rspec:rr", [], :style => :foo
;T;0o;
;	[I"EBesides giving an instance, you can also give a class to invoke:;T@o;;	[I")invoke Rspec::RR, [], :style => :foo;T;0:
@fileI"3lib/bundler/vendor/thor/lib/thor/invocation.rb;T:0@omit_headings_from_table_of_contents_below000[I"(name = nil, *args);T@_FI"Invocation;TcRDoc::NormalModule00