Skip to content

Commit 25d11d8

Browse files
committed
using attr_writer rather than defining our own writers
1 parent e4a2317 commit 25d11d8

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/resque.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ def before_first_fork(&block)
7777

7878
# Set a proc that will be called in the parent process before the
7979
# worker forks for the first time.
80-
def before_first_fork=(before_first_fork)
81-
@before_first_fork = before_first_fork
82-
end
80+
attr_writer :before_first_fork
8381

8482
# The `before_fork` hook will be run in the **parent** process
8583
# before every job, so be careful- any changes you make will be
@@ -92,9 +90,7 @@ def before_fork(&block)
9290
end
9391

9492
# Set the before_fork proc.
95-
def before_fork=(before_fork)
96-
@before_fork = before_fork
97-
end
93+
attr_writer :before_fork
9894

9995
# The `after_fork` hook will be run in the child process and is passed
10096
# the current job. Any changes you make, therefore, will only live as
@@ -107,9 +103,7 @@ def after_fork(&block)
107103
end
108104

109105
# Set the after_fork proc.
110-
def after_fork=(after_fork)
111-
@after_fork = after_fork
112-
end
106+
attr_writer :after_fork
113107

114108
def to_s
115109
"Resque Client connected to #{redis_id}"

0 commit comments

Comments
 (0)