Skip to content

Commit 2bde157

Browse files
committed
Better Maybe docs.
1 parent 1358f7f commit 2bde157

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/concurrent/maybe.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ module Concurrent
5151
# ```ruby
5252
# result = MyFileUtils.consult("data.dat") # returns a Maybe
5353
# if result.just?
54-
# do_something_useful(result.just) # or result.value
54+
# do_something_useful(result.value) # or result.just
5555
# else
56-
# logger.error(result.nothing) # or result.reason
56+
# logger.error(result.reason) # or result.nothing
5757
# end
5858
# ```
5959
#
@@ -72,12 +72,12 @@ module Concurrent
7272
# maybe = MyFileUtils.consult('bogus.file')
7373
# maybe.just? #=> false
7474
# maybe.nothing? #=> true
75-
# maybe.nothing #=> #<Errno::ENOENT: No such file or directory @ rb_sysopen - bogus.file>
75+
# maybe.reason #=> #<Errno::ENOENT: No such file or directory @ rb_sysopen - bogus.file>
7676
#
7777
# maybe = MyFileUtils.consult('README.md')
7878
# maybe.just? #=> true
7979
# maybe.nothing? #=> false
80-
# maybe.just #=> "# Concurrent Ruby\n[![Gem Version..."
80+
# maybe.value #=> "# Concurrent Ruby\n[![Gem Version..."
8181
#
8282
# @example Using Maybe with a Block
8383
# result = Concurrent::Maybe.from do
@@ -86,11 +86,11 @@ module Concurrent
8686
#
8787
# # -- if the record was found
8888
# result.just? #=> true
89-
# result.just #=> #<Client id: 10, first_name: "Ryan">
89+
# result.value #=> #<Client id: 10, first_name: "Ryan">
9090
#
9191
# # -- if the record was not found
92-
# result.just? #=> false
93-
# result.nothing #=> ActiveRecord::RecordNotFound
92+
# result.just? #=> false
93+
# result.reason #=> ActiveRecord::RecordNotFound
9494
#
9595
# @example Using Maybe with the Null Object Pattern
9696
# # In a Rails controller...

0 commit comments

Comments
 (0)