re: Daily Challenge #1 - String Peeler VIEW POST

FULL DISCUSSION
 

Ruby Language Version

With specs

def trim value
  value.to_s[1...-1]
end

require "spec"

describe "#trim" do
  it { expect(trim "Foo Bar").to eq "oo Ba"}
  it { expect(trim "Foo").to eq "o"}
  it { expect(trim "Fo").to eq ""}
  it { expect(trim "F").to eq ""}
  it { expect(trim nil).to be_nil}
  it { expect(trim 777).to eq "7"}
end

output

>> rspec debook_ends.rb
......

Finished in 0.00696 seconds (files took 0.15187 seconds to load)
6 examples, 0 failures
code of conduct - report abuse