Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/concurrent/atomic/atomic_boolean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module Concurrent
class AtomicBoolean < AtomicBooleanImplementation
# @return [String] Short string representation.
def to_s
format '<#%s:0x%x value:%s>', self.class, object_id << 1, value
format '%s value:%s>', super[0..-2], value
end

alias_method :inspect, :to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/concurrent/atomic/atomic_fixnum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module Concurrent
class AtomicFixnum < AtomicFixnumImplementation
# @return [String] Short string representation.
def to_s
format '<#%s:0x%x value:%s>', self.class, object_id << 1, value
format '%s value:%s>', super[0..-2], value
end

alias_method :inspect, :to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/concurrent/atomic/atomic_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Concurrent::AtomicReference < Concurrent::MutexAtomicReference
class Concurrent::AtomicReference
# @return [String] Short string representation.
def to_s
format '<#%s:0x%x value:%s>', self.class, object_id << 1, get
format '%s value:%s>', super[0..-2], get
end

alias_method :inspect, :to_s
Expand Down
4 changes: 2 additions & 2 deletions lib/concurrent/edge/cancellation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def canceled?
# Short string representation.
# @return [String]
def to_s
format '<#%s:0x%x canceled:%s>', self.class, object_id << 1, canceled?
format '%s canceled:%s>', super[0..-2], canceled?
end

alias_method :inspect, :to_s
Expand Down Expand Up @@ -120,7 +120,7 @@ def join(*tokens, &block)
# Short string representation.
# @return [String]
def to_s
format '<#%s:0x%x canceled:%s>', self.class, object_id << 1, canceled?
format '%s canceled:%s>', super[0..-2], canceled?
end

alias_method :inspect, :to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/concurrent/edge/lock_free_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def clear_each(&block)

# @return [String] Short string representation.
def to_s
format '<#%s:0x%x %s>', self.class, object_id << 1, to_a.to_s
format '%s %s>', super[0..-2], to_a.to_s
end

alias_method :inspect, :to_s
Expand Down
4 changes: 2 additions & 2 deletions lib/concurrent/edge/promises.rb
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def chain_on(executor, *args, &task)

# @return [String] Short string representation.
def to_s
format '<#%s:0x%x %s>', self.class, object_id << 1, state
format '%s %s>', super[0..-2], state
end

alias_method :inspect, :to_s
Expand Down Expand Up @@ -2067,7 +2067,7 @@ def pop_for_select(probe = Concurrent::Promises.resolvable_future)

# @return [String] Short string representation.
def to_s
format '<#%s:0x%x size:%s>', self.class, object_id << 1, @Size
format '%s size:%s>', super[0..-2], @Size
end

alias_method :inspect, :to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/concurrent/edge/throttle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def throttled_block(&block)

# @return [String] Short string representation.
def to_s
format '<#%s:0x%x limit:%s can_run:%d>', self.class, object_id << 1, @Limit, can_run
format '%s limit:%s can_run:%d>', super[0..-2], @Limit, can_run
end

alias_method :inspect, :to_s
Expand Down
4 changes: 2 additions & 2 deletions spec/concurrent/edge/promises_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ def behaves_as_delay(delay, value)
four = three.delay.then(&:succ)

# meaningful to_s and inspect defined for Future and Promise
expect(head.to_s).to match(/<#Concurrent::Promises::Future:0x[\da-f]+ pending>/)
expect(head.to_s).to match(/#<Concurrent::Promises::Future:0x[\da-f]+ pending>/)
expect(head.inspect).to(
match(/<#Concurrent::Promises::Future:0x[\da-f]+ pending>/))
match(/#<Concurrent::Promises::Future:0x[\da-f]+ pending>/))

# evaluates only up to three, four is left unevaluated
expect(three.value!).to eq 3
Expand Down