Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added Ruby version information to the output.
  • Loading branch information
jimweirich committed Sep 27, 2010
1 parent 322ca38 commit 8436b46
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/edgecase.rb
Expand Up @@ -57,6 +57,19 @@ def ____(method=nil)
end
end

class String
def side_padding(width)
extra = width - self.size
if width < 0
self
else
left_padding = extra / 2
right_padding = (extra+1)/2
(" " * left_padding) + self + (" " *right_padding)
end
end
end

module EdgeCase
class << self
def simple_output
Expand Down Expand Up @@ -202,6 +215,9 @@ def boring_end_screen
end

def artistic_end_screen
"JRuby 1.9.x Koans"
ruby_version = "(in #{'J' if defined?(JRUBY_VERSION)}Ruby #{defined?(JRUBY_VERSION) ? JRUBY_VERSION : RUBY_VERSION})"
ruby_version = ruby_version.side_padding(54)
completed = <<-ENDTEXT
,, , ,,
: ::::, :::,
Expand All @@ -218,8 +234,8 @@ def artistic_end_screen
,:::::::::::, ::::::::::::,
:::::::::::, ,::::::::::::
::::::::::::: ,::::::::::::
:::::::::::: Ruby Koans ::::::::::::,
:::::::::::: ,::::::::::::,
:::::::::::: Ruby Koans ::::::::::::,
::::::::::::#{ ruby_version },::::::::::::,
:::::::::::, , ::::::::::::
,:::::::::::::, brought to you by ,,::::::::::::,
:::::::::::::: ,::::::::::::
Expand Down

0 comments on commit 8436b46

Please sign in to comment.