Skip to content

Commit 160a457

Browse files
committed
Few to_s improvements
1 parent c3c9a47 commit 160a457

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/concurrent/atomic/atomic_fixnum.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,9 @@ module Concurrent
129129
#
130130
# @!macro atomic_fixnum_public_api
131131
class AtomicFixnum < AtomicFixnumImplementation
132+
# @return [String] Short string representation.
133+
def to_s
134+
format '<#%s:0x%x value:%s>', self.class, object_id << 1, get
135+
end
132136
end
133137
end

lib/concurrent/atomic/atomic_reference.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,10 @@ class Concurrent::AtomicReference < Concurrent::CAtomicReference
4040
class Concurrent::AtomicReference < Concurrent::MutexAtomicReference
4141
end
4242
end
43+
44+
class Concurrent::AtomicReference
45+
# @return [String] Short string representation.
46+
def to_s
47+
format '<#%s:0x%x value:%s>', self.class, object_id << 1, get
48+
end
49+
end

lib/concurrent/edge/lock_free_stack.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,10 @@ def clear_each(&block)
113113
end
114114
end
115115
end
116+
117+
# @return [String] Short string representation.
118+
def to_s
119+
format '<#%s:0x%x %s>', self.class, object_id << 1, to_a.to_s
120+
end
116121
end
117122
end

0 commit comments

Comments
 (0)