mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Rename Pry::CLI.process_options to add_option_processor . This method dose not process options but adds option processor, so rename it.
This commit is contained in:
parent
36840ecebf
commit
090e58ccdc
2 changed files with 5 additions and 5 deletions
|
@ -44,7 +44,7 @@ class Pry
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a block responsible for processing parsed options.
|
# Add a block responsible for processing parsed options.
|
||||||
def process_options(&block)
|
def add_option_processor(&block)
|
||||||
self.option_processors ||= []
|
self.option_processors ||= []
|
||||||
option_processors << block
|
option_processors << block
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ Copyright (c) 2013 John Mair (banisterfiend)
|
||||||
"Start the session in the specified context. Equivalent to `context.pry` in a session.",
|
"Start the session in the specified context. Equivalent to `context.pry` in a session.",
|
||||||
:default => "Pry.toplevel_binding"
|
:default => "Pry.toplevel_binding"
|
||||||
)
|
)
|
||||||
end.process_options do |opts|
|
end.add_option_processor do |opts|
|
||||||
|
|
||||||
exit if opts.help?
|
exit if opts.help?
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe Pry::Hooks do
|
||||||
|
|
||||||
Pry::CLI.add_options do
|
Pry::CLI.add_options do
|
||||||
on :optiontest, "A test option"
|
on :optiontest, "A test option"
|
||||||
end.process_options do |opts|
|
end.add_option_processor do |opts|
|
||||||
run = true if opts.present?(:optiontest)
|
run = true if opts.present?(:optiontest)
|
||||||
end.parse_options(["--optiontest"])
|
end.parse_options(["--optiontest"])
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ describe Pry::Hooks do
|
||||||
Pry::CLI.add_options do
|
Pry::CLI.add_options do
|
||||||
on :optiontest, "A test option"
|
on :optiontest, "A test option"
|
||||||
on :optiontest2, "Another test option"
|
on :optiontest2, "Another test option"
|
||||||
end.process_options do |opts|
|
end.add_option_processor do |opts|
|
||||||
run = true if opts.present?(:optiontest)
|
run = true if opts.present?(:optiontest)
|
||||||
end.process_options do |opts|
|
end.add_option_processor do |opts|
|
||||||
run2 = true if opts.present?(:optiontest2)
|
run2 = true if opts.present?(:optiontest2)
|
||||||
end.parse_options(["--optiontest", "--optiontest2"])
|
end.parse_options(["--optiontest", "--optiontest2"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue