Skip to content

Commit

Permalink
Remove unused String.shorten extension (#204)
Browse files Browse the repository at this point in the history
It's only used in one view, and that view is unused and broken.

And anyway, Rails 3 has a built-in truncate method that we can use
instead (it's slightly different in how it interprets the length).

Suggested-by: Ben Anderson <[email protected]>
  • Loading branch information
tom93 authored Dec 22, 2023
1 parent 1072b10 commit 9bd2b66
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/views/test_cases/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<% @test_cases.each do |test_case| %>
<tr>
<td><%= simple_format(test_case.input.shorten) %></td>
<td><%= simple_format(test_case.output.shorten) %></td>
<td><%= simple_format(test_case.input.truncate(100)) %></td>
<td><%= simple_format(test_case.output.truncate(100)) %></td>
<td><%= test_case.test_set_ids.to_s %></td>
<td><%= test_case.name %></td>
<td><%= test_case.problem_ids %></td>
Expand Down
4 changes: 0 additions & 4 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)

require 'ext/string'
#longest length a string can be before it's truncated in index view
SHORTEN_LIMIT = 100

#Initialize the rails application
NZTrain::Application.initialize!
9 changes: 0 additions & 9 deletions lib/ext/string.rb

This file was deleted.

0 comments on commit 9bd2b66

Please sign in to comment.