Skip to content

Commit a91f32c

Browse files
committed
Rewrite non-trivial usage of alias to direct invocation.
1 parent e9cc6f0 commit a91f32c

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

lib/async/queue.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def push(item)
4545
end
4646

4747
# Compatibility with {::Queue#push}.
48-
alias << push
48+
def <<(item)
49+
self.push(item)
50+
end
4951

5052
# Add multiple items to the queue.
5153
def enqueue(*items)
@@ -64,7 +66,9 @@ def dequeue
6466
end
6567

6668
# Compatibility with {::Queue#pop}.
67-
alias pop dequeue
69+
def pop
70+
self.dequeue
71+
end
6872

6973
# Process each item in the queue.
7074
#
@@ -132,9 +136,6 @@ def push(item)
132136

133137
super
134138
end
135-
136-
# Compatibility with {::Queue#push}.
137-
alias << push
138139

139140
# Add multiple items to the queue.
140141
#
@@ -166,8 +167,5 @@ def dequeue
166167

167168
return item
168169
end
169-
170-
# Compatibility with {::Queue#pop}.
171-
alias pop dequeue
172170
end
173171
end

lib/async/task.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ def completed?
181181
@status == :completed
182182
end
183183

184-
alias complete? completed?
184+
# Alias for {#completed?}.
185+
def complete?
186+
self.completed?
187+
end
185188

186189
# @attribute [Symbol] The status of the execution of the task, one of `:initialized`, `:running`, `:complete`, `:stopped` or `:failed`.
187190
attr :status

lib/async/variable.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ def resolve(value = true)
3131
condition.signal(value)
3232
end
3333

34-
alias value= resolve
34+
# Alias for {#resolve}.
35+
def value=(value)
36+
self.resolve(value)
37+
end
3538

3639
# Whether the value has been resolved.
3740
#
@@ -48,6 +51,9 @@ def wait
4851
return @value
4952
end
5053

51-
alias value wait
54+
# Alias for {#wait}.
55+
def value
56+
self.wait
57+
end
5258
end
5359
end

0 commit comments

Comments
 (0)