Skip to content

Commit 3af974e

Browse files
committed
Fixed yardoc errors.
1 parent e1aa0ec commit 3af974e

File tree

2 files changed

+44
-44
lines changed

2 files changed

+44
-44
lines changed

lib/concurrent/ivar.rb

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,7 @@ module Concurrent
2626
# when the values they depend on are ready you want `dataflow`. `IVar` is
2727
# generally a low-level primitive.
2828
#
29-
# @!macro [attach] copy_options
30-
# ## Copy Options
31-
#
32-
# Object references in Ruby are mutable. This can lead to serious
33-
# problems when the {#value} of an object is a mutable reference. Which
34-
# is always the case unless the value is a `Fixnum`, `Symbol`, or similar
35-
# "primative" data type. Each instance can be configured with a few
36-
# options that can help protect the program from potentially dangerous
37-
# operations. Each of these options can be optionally set when the oject
38-
# instance is created:
39-
#
40-
# * `:dup_on_deref` When true the object will call the `#dup` method on
41-
# the `value` object every time the `#value` methid is called
42-
# (default: false)
43-
# * `:freeze_on_deref` When true the object will call the `#freeze`
44-
# method on the `value` object every time the `#value` method is called
45-
# (default: false)
46-
# * `:copy_on_deref` When given a `Proc` object the `Proc` will be run
47-
# every time the `#value` method is called. The `Proc` will be given
48-
# the current `value` as its only argument and the result returned by
49-
# the block will be the return value of the `#value` call. When `nil`
50-
# this option will be ignored (default: nil)
51-
#
52-
# When multiple deref options are set the order of operations is strictly defined.
53-
# The order of deref operations is:
54-
# * `:copy_on_deref`
55-
# * `:dup_on_deref`
56-
# * `:freeze_on_deref`
57-
#
58-
# Because of this ordering there is no need to `#freeze` an object created by a
59-
# provided `:copy_on_deref` block. Simply set `:freeze_on_deref` to `true`.
60-
# Setting both `:dup_on_deref` to `true` and `:freeze_on_deref` to `true` is
61-
# as close to the behavior of a "pure" functional language (like Erlang, Clojure,
62-
# or Haskell) as we are likely to get in Ruby.
29+
# @!macro copy_options
6330
#
6431
# ## Examples
6532
#
@@ -91,14 +58,7 @@ class IVar < Synchronization::Object
9158
# @param [Object] value the initial value
9259
# @param [Hash] opts the options to create a message with
9360
#
94-
# @!macro [attach] deref_options
95-
# @option opts [Boolean] :dup_on_deref (false) Call `#dup` before
96-
# returning the data from {#value}
97-
# @option opts [Boolean] :freeze_on_deref (false) Call `#freeze` before
98-
# returning the data from {#value}
99-
# @option opts [Proc] :copy_on_deref (nil) When calling the {#value}
100-
# method, call the given proc passing the internal value as the sole
101-
# argument then return the new value returned from the proc.
61+
# @!macro deref_options
10262
def initialize(value = NO_VALUE, opts = {}, &block)
10363
if value != NO_VALUE && block_given?
10464
raise ArgumentError.new('provide only a value or a block')

lib/concurrent/mvar.rb

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,40 @@ module Concurrent
2424
# Note that unlike the original Haskell paper, our `#take` is blocking. This is how
2525
# Haskell and Scala do it today.
2626
#
27-
# @!macro copy_options
27+
# @!macro [attach] copy_options
28+
# ## Copy Options
29+
#
30+
# Object references in Ruby are mutable. This can lead to serious
31+
# problems when the {#value} of an object is a mutable reference. Which
32+
# is always the case unless the value is a `Fixnum`, `Symbol`, or similar
33+
# "primative" data type. Each instance can be configured with a few
34+
# options that can help protect the program from potentially dangerous
35+
# operations. Each of these options can be optionally set when the oject
36+
# instance is created:
37+
#
38+
# * `:dup_on_deref` When true the object will call the `#dup` method on
39+
# the `value` object every time the `#value` methid is called
40+
# (default: false)
41+
# * `:freeze_on_deref` When true the object will call the `#freeze`
42+
# method on the `value` object every time the `#value` method is called
43+
# (default: false)
44+
# * `:copy_on_deref` When given a `Proc` object the `Proc` will be run
45+
# every time the `#value` method is called. The `Proc` will be given
46+
# the current `value` as its only argument and the result returned by
47+
# the block will be the return value of the `#value` call. When `nil`
48+
# this option will be ignored (default: nil)
49+
#
50+
# When multiple deref options are set the order of operations is strictly defined.
51+
# The order of deref operations is:
52+
# * `:copy_on_deref`
53+
# * `:dup_on_deref`
54+
# * `:freeze_on_deref`
55+
#
56+
# Because of this ordering there is no need to `#freeze` an object created by a
57+
# provided `:copy_on_deref` block. Simply set `:freeze_on_deref` to `true`.
58+
# Setting both `:dup_on_deref` to `true` and `:freeze_on_deref` to `true` is
59+
# as close to the behavior of a "pure" functional language (like Erlang, Clojure,
60+
# or Haskell) as we are likely to get in Ruby.
2861
#
2962
# ## See Also
3063
#
@@ -49,7 +82,14 @@ class MVar
4982
#
5083
# @param [Hash] opts the options controlling how the future will be processed
5184
#
52-
# @!macro deref_options
85+
# @!macro [attach] deref_options
86+
# @option opts [Boolean] :dup_on_deref (false) Call `#dup` before
87+
# returning the data from {#value}
88+
# @option opts [Boolean] :freeze_on_deref (false) Call `#freeze` before
89+
# returning the data from {#value}
90+
# @option opts [Proc] :copy_on_deref (nil) When calling the {#value}
91+
# method, call the given proc passing the internal value as the sole
92+
# argument then return the new value returned from the proc.
5393
def initialize(value = EMPTY, opts = {})
5494
@value = value
5595
@mutex = Mutex.new

0 commit comments

Comments
 (0)