Skip to content

Commit a64aa02

Browse files
committed
some minor style fixes
1 parent 211697b commit a64aa02

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

lib/concurrent/dataflow.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def initialize(count, &block)
1313

1414
def update(time, value, reason)
1515
if @counter.decrement == 0
16-
@block.call()
16+
@block.call
1717
end
1818
end
1919
end

lib/concurrent/future.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'thread'
22

3+
require 'concurrent/obligation'
34
require 'concurrent/global_thread_pool'
45
require 'concurrent/safe_task_executor'
56

lib/concurrent/mvar.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'concurrent/dereferenceable'
12
require 'concurrent/event'
23

34
module Concurrent

lib/concurrent/obligation.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,28 @@ module Obligation
1111

1212
# Has the obligation been fulfilled?
1313
# @return [Boolean]
14-
def fulfilled?() state == :fulfilled; end
14+
def fulfilled?
15+
state == :fulfilled
16+
end
1517
alias_method :realized?, :fulfilled?
1618

1719
# Has the obligation been rejected?
1820
# @return [Boolean]
19-
def rejected?() state == :rejected; end
21+
def rejected?
22+
state == :rejected
23+
end
2024

2125
# Is obligation completion still pending?
2226
# @return [Boolean]
23-
def pending?() state == :pending; end
27+
def pending?
28+
state == :pending
29+
end
2430

2531
# Is the obligation still unscheduled?
2632
# @return [Boolean]
27-
def unscheduled?() state == :unscheduled; end
33+
def unscheduled?
34+
state == :unscheduled
35+
end
2836

2937
def completed?
3038
[:fulfilled, :rejected].include? state

lib/concurrent/postable.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'concurrent/event'
2+
13
module Concurrent
24

35
module Postable
@@ -37,20 +39,20 @@ def post(*message)
3739
raise ArgumentError.new('empty message') if message.empty?
3840
return false unless ready?
3941
queue.push(Package.new(message))
40-
return true
42+
true
4143
end
4244

4345
def <<(message)
4446
post(*message)
45-
return self
47+
self
4648
end
4749

4850
def post?(*message)
4951
raise ArgumentError.new('empty message') if message.empty?
5052
return nil unless ready?
5153
ivar = IVar.new
5254
queue.push(Package.new(message, ivar))
53-
return ivar
55+
ivar
5456
end
5557

5658
def post!(seconds, *message)
@@ -77,14 +79,14 @@ def forward(receiver, *message)
7779
raise ArgumentError.new('empty message') if message.empty?
7880
return false unless ready?
7981
queue.push(Package.new(message, receiver))
80-
return queue.length
82+
queue.length
8183
end
8284

8385
def ready?
8486
if self.respond_to?(:running?) && ! running?
85-
return false
87+
false
8688
else
87-
return true
89+
true
8890
end
8991
end
9092

lib/concurrent/stoppable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ def before_stop(&block)
88
raise ArgumentError.new('no block given') unless block_given?
99
raise Runnable::LifecycleError.new('#before_stop already set') if @before_stop_proc
1010
@before_stop_proc = block
11-
return self
11+
self
1212
end
1313

1414
protected
1515

1616
def before_stop_proc
17-
return @before_stop_proc
17+
@before_stop_proc
1818
end
1919
end
2020
end

0 commit comments

Comments
 (0)