I have created a small program that tries to use the center string
method.
Here is the code.
name1 = ‘larry’
name2 = ‘curly’
name3 = ‘moe’
health1 = 60
health2 = 125
health3 = 100
puts “#{name1.capitalize}'s health is #{health1}.”
puts “#{name2.upcase} has a health of #{health2}.”
stringVariable = “#{name3.capitalize} has a health of #{health3}.”
puts stringVariable.center(20, ‘*’)
The problem is that center does not seem to work in the rubymine
(v6.0.3) console so I get the following result.
/Users/Administrator/.rbenv/versions/2.1.1/bin/ruby -e
$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
/Users/Administrator/RubymineProjects/PragmaticGame/studio_game.rb
Larry’s health is 60.
CURLY has a health of 125.
Moe has a health of 100.
Process finished with exit code 0