mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
version 0.5.5, improved docs, added a couple of easter eggs for kicks
This commit is contained in:
parent
5cda6865d4
commit
df4e19edb3
3 changed files with 45 additions and 2 deletions
|
@ -439,5 +439,47 @@ e.g: show-method hello_method
|
|||
|
||||
alias_command "quit", "exit", ""
|
||||
alias_command "back", "exit", ""
|
||||
end
|
||||
|
||||
command "game", "" do |highest|
|
||||
highest = highest ? highest.to_i : 100
|
||||
num = rand(highest)
|
||||
output.puts "Guess the number between 0-#{highest}: ('.' to quit)"
|
||||
count = 0
|
||||
while(true)
|
||||
count += 1
|
||||
str = Readline.readline("game > ", true).chomp
|
||||
break if str == "."
|
||||
val = str.to_i
|
||||
output.puts "Too large!" if val > num
|
||||
output.puts "Too small!" if val < num
|
||||
if val == num
|
||||
output.puts "Well done! You guessed right! It took you #{count} guesses."
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
command "cohen-poem", "" do
|
||||
text = %{
|
||||
--
|
||||
When this American woman,
|
||||
whose thighs are bound in casual red cloth,
|
||||
comes thundering past my sitting place
|
||||
like a forest-burning Mongol tribe,
|
||||
the city is ravished
|
||||
and brittle buildings of a hundred years
|
||||
splash into the street;
|
||||
and my eyes are burnt
|
||||
for the embroidered Chinese girls,
|
||||
already old,
|
||||
and so small between the thin pines
|
||||
on these enormous landscapes,
|
||||
that if you turn your head
|
||||
they are lost for hours.
|
||||
-- Leonard Cohen
|
||||
}
|
||||
output.puts text
|
||||
text
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -102,6 +102,7 @@ class Pry
|
|||
# @param [String] arg_string The Pry command (including arguments,
|
||||
# if any).
|
||||
# @param [Hash] options Optional named parameters.
|
||||
# @return [Object] The return value of the Pry command.
|
||||
# @option options [Object, Binding] :context The object context to run the
|
||||
# command under. Defaults to `TOPLEVEL_BINDING` (main).
|
||||
# @option options [Boolean] :show_output Whether to show command
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Pry
|
||||
VERSION = "0.5.4"
|
||||
VERSION = "0.5.5"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue