Skip to content

Commit

Permalink
Make value the alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 18, 2024
1 parent 3c4eb3a commit 042d12b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/async/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def resolve(value = true)
condition.signal(value)
end

alias value= resolve

# Whether the value has been resolved.
#
# @returns [Boolean] Whether the value has been resolved.
Expand All @@ -41,14 +43,11 @@ def resolved?
# Wait for the value to be resolved.
#
# @returns [Object] The resolved value.
def value
def wait
@condition&.wait
return @value
end

# Alias for {#value}.
def wait
self.value
end
alias value wait
end
end

0 comments on commit 042d12b

Please sign in to comment.