clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / Atom feed
* [PATCH] doc: document Fiber.current
@ 2020-08-10 22:23 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-08-10 22:23 UTC (permalink / raw)
  To: clogger-public

It's always been supported (since it's just an eval), but make
it explicit.  We'll also drop the Actor.current example since
both Rubinius and Revactor seem dead and Ractor (Guild) is
probably coming...
---
 README               |  2 +-
 test/test_clogger.rb | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/README b/README
index c90dd1a..cdb8fba 100644
--- a/README
+++ b/README
@@ -89,7 +89,7 @@ that receives a "<<" method:
 * $ip - X-Forwarded-For request header if available, $remote_addr if not
 * $pid - process ID of the current process
 * $e{Thread.current} - Thread processing the request
-* $e{Actor.current} - Actor processing the request (Revactor or Rubinius)
+* $e{Fiber.current} - Fiber processing the request
 * $env{variable_name} - any Rack environment variable (e.g. rack.url_scheme)
 
 == REQUIREMENTS
diff --git a/test/test_clogger.rb b/test/test_clogger.rb
index b7dd4e9..1dee652 100644
--- a/test/test_clogger.rb
+++ b/test/test_clogger.rb
@@ -212,6 +212,22 @@ class TestClogger < Test::Unit::TestCase
     assert_equal "-#{current}-\n", str.string
   end
 
+  def test_fiber
+    begin
+      current = Fiber.current.to_s
+    rescue NameError => e
+      warn "your Ruby does not support fibers #{e}"
+      return
+    end
+    str = StringIO.new
+    app = lambda { |env| [ 302, {}, [] ] }
+    cl = Clogger.new(app,
+                    :logger => str,
+                    :format => "-$e{Fiber.current}-\n")
+    status, headers, body = cl.call(@req)
+    assert_equal "-#{current}-\n", str.string
+  end
+
   def test_pid
     str = StringIO.new
     app = lambda { |env| [ 302, {}, [] ] }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-10 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 22:23 [PATCH] doc: document Fiber.current Eric Wong

clogger RubyGem user+dev discussion/patches/pulls/bugs/help

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhbt.net/clogger-public
	git clone --mirror http://ou63pmih66umazou.onion/clogger-public

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 clogger-public clogger-public/ https://yhbt.net/clogger-public \
		clogger-public@yhbt.net clogger-public@bogomips.org clogger@librelist.org clogger@librelist.com
	public-inbox-index clogger-public

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.clogger
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.clogger
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	clogger.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git