Skip to content

Commit b669efd

Browse files
authored
[ruby/sinatra-sequel] Use erb for templates (#8990)
erb templates have better performance than slim templates. This also makes it more inline with the Ruby/sinatra tests, which also use erb.
1 parent b976fe8 commit b669efd

File tree

6 files changed

+24
-19
lines changed

6 files changed

+24
-19
lines changed

Diff for: frameworks/Ruby/sinatra-sequel/Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ gem 'passenger', '~> 6.0', :platforms=>[:ruby, :mswin], :require=>false
55
gem 'puma', '~> 6.4', :require=>false
66
gem 'sequel', '~> 5.0'
77
gem 'sinatra', '~> 3.0', :require=>'sinatra/base'
8-
gem 'slim', '~> 3.0'
98
gem 'unicorn', '~> 6.1', :platforms=>[:ruby, :mswin], :require=>false
109

1110
group :mysql do

Diff for: frameworks/Ruby/sinatra-sequel/hello_world.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Configure Slim templating engine
4-
Slim::Engine.set_options :format=>:html, :sort_attrs=>false
5-
63
# Our Rack application to be executed by rackup
74
class HelloWorld < Sinatra::Base
85
configure do
@@ -73,7 +70,7 @@ def rand1
7370
)
7471
@fortunes.sort_by!(&:message)
7572

76-
slim :fortunes
73+
erb :fortunes, :layout=>true
7774
end
7875

7976
# Test type 5: Database updates

Diff for: frameworks/Ruby/sinatra-sequel/views/fortunes.erb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<table>
2+
<tr>
3+
<th>id</th>
4+
<th>message</th>
5+
</tr>
6+
<% @fortunes.each do |fortune| %>
7+
<tr>
8+
<td><%= fortune.id %></td>
9+
<td><%= Rack::Utils.escape_html(fortune.message) %></td>
10+
</tr>
11+
<% end %>
12+
</table>

Diff for: frameworks/Ruby/sinatra-sequel/views/fortunes.slim

-8
This file was deleted.

Diff for: frameworks/Ruby/sinatra-sequel/views/layout.erb

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Fortunes</title>
5+
</head>
6+
7+
<body>
8+
<%= yield %>
9+
</body>
10+
11+
</html>

Diff for: frameworks/Ruby/sinatra-sequel/views/layout.slim

-6
This file was deleted.

0 commit comments

Comments
 (0)