Skip to content

Commit 4351b9b

Browse files
committed
Move example from Trenni -> XRB.
1 parent 486074a commit 4351b9b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

examples/trenni/Gemfile renamed to examples/xrb/gems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
source "https://rubygems.org"
44

5-
gem "trenni"
5+
gem "xrb"
66
gem "async-http"

examples/trenni/streaming.rb renamed to examples/xrb/streaming.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
#!/usr/bin/env ruby
12
# frozen_string_literal: true
23

34
# Released under the MIT License.
4-
# Copyright, 2019-2025, by Samuel Williams.
5+
# Copyright, 2019-2024, by Samuel Williams.
56

6-
require "trenni/template"
7+
require "xrb/template"
78

89
require "async"
910
require "async/http/body/writable"
1011

1112
# The template, using inline text. The sleep could be anything - database query, HTTP request, redis, etc.
12-
buffer = Trenni::Buffer.new(<<-EOF)
13+
buffer = XRB::Buffer.new(<<-EOF)
1314
The "\#{self[:count]} bottles of \#{self[:drink]} on the wall" song!
1415
1516
<?r self[:count].downto(1) do |index| ?>
@@ -22,15 +23,15 @@
2223
<?r end ?>
2324
EOF
2425

25-
template = Trenni::Template.new(buffer)
26+
template = XRB::Template.new(buffer)
2627

2728
Async do
2829
body = Async::HTTP::Body::Writable.new
29-
30+
3031
generator = Async do
3132
template.to_string({count: 100, drink: "coffee"}, body)
3233
end
33-
34+
3435
while chunk = body.read
3536
$stdout.write chunk
3637
end

0 commit comments

Comments
 (0)