Skip to content

Commit c5cdd5e

Browse files
author
Badacadabra
committed
Refactor everything using modules
1 parent e64ea37 commit c5cdd5e

File tree

585 files changed

+8608
-7149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

585 files changed

+8608
-7149
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tags
280 Bytes
Binary file not shown.
3.42 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict'
2+
3+
# ==============================
4+
# ABSTRACT RACER
5+
# ==============================
6+
7+
class Racer
8+
constructor: ->
9+
throw new Error "You cannot instantiate an abstract class!" if @constructor is Racer
10+
11+
go: ->
12+
res = ""
13+
if @nextRelay? then res += @nextRelay.go() else res += ""
14+
res
15+
16+
setNextRelay: (relay) ->
17+
@nextRelay = relay
18+
19+
module.exports = Racer
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
Racer = require './Racer'
4+
5+
# ==============================
6+
# CONCRETE RACER
7+
# ==============================
8+
9+
class Runner extends Racer
10+
go: ->
11+
"Runner: go!\n#{super}"
12+
13+
module.exports = Runner
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
Racer = require './Racer'
4+
5+
# ==============================
6+
# CONCRETE RACER
7+
# ==============================
8+
9+
class Swimmer extends Racer
10+
go: ->
11+
"Swimmer: go!\n#{super}"
12+
13+
module.exports = Swimmer
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
Racer = require './Racer'
4+
5+
# ==============================
6+
# CONCRETE RACER
7+
# ==============================
8+
9+
class Walker extends Racer
10+
go: ->
11+
"Walker: go!\n#{super}"
12+
13+
module.exports = Walker

src/CoffeeScript/GoF/Behavioral/ChainOfResponsibility/ChainOfResponsibility.coffee

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict'
2+
3+
Walker = require './API/Walker'
4+
Runner = require './API/Runner'
5+
Swimmer = require './API/Swimmer'
6+
7+
# ==============================
8+
# CLIENT CODE
9+
# ==============================
10+
11+
walker = new Walker
12+
runner = new Runner
13+
swimmer = new Swimmer
14+
15+
walker.setNextRelay runner
16+
runner.setNextRelay swimmer
17+
18+
console.log walker.go()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict'
2+
3+
# ==============================
4+
# CONCRETE CUSTOMER
5+
# ==============================
6+
7+
class Customer
8+
pay: ->
9+
"Payment OK!\n"
10+
11+
module.exports = Customer

0 commit comments

Comments
 (0)