Skip to content

Commit 50ab300

Browse files
committed
Fixed decorator sample (thanks tixz)
* TextDecorator was written in JavaScript-style function assignment, making the @processors variable drop out of scope * Rewrote it as class TextDecorator and included a constructor to set the var
1 parent cbe19ff commit 50ab300

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

chapters/design_patterns/decorator.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ miniMarkdown = (line) ->
2626
stripComments = (line) ->
2727
line.replace /\s*\/\/.*$/, '' # Removes one-line, double-slash C-style comments
2828

29-
TextProcessor = (@processors) ->
29+
class TextProcessor
30+
constructor: (@processors) ->
31+
3032
reducer: (existing, processor) ->
3133
if processor
3234
processor(existing or '')

0 commit comments

Comments
 (0)