summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/movie.coffee22
-rw-r--r--src/specification.coffee20
2 files changed, 22 insertions, 20 deletions
diff --git a/src/movie.coffee b/src/movie.coffee
index e00a4f9..b227dda 100644
--- a/src/movie.coffee
+++ b/src/movie.coffee
@@ -1,3 +1,5 @@
+WhereSpecification = require('./specification')
+
module.exports = class Movie
constructor: (attributes) ->
@title = attributes['title']
@@ -10,23 +12,3 @@ module.exports = class Movie
@where: (condition) ->
new WhereSpecification(condition)
-class OrSpecification
- constructor: (left, right) ->
- @left = left
- @right = right
-
- matches: (item) ->
- @left.matches(item) || @right.matches(item)
-
-class WhereSpecification
- constructor: (condition) ->
- @condition = condition
-
- matches: (item) ->
- for key in Object.keys(@condition)
- return false if item[key] != @condition[key]
- return true
-
- or: (other_specification) ->
- new OrSpecification(this, other_specification)
-
diff --git a/src/specification.coffee b/src/specification.coffee
new file mode 100644
index 0000000..3cdd1dc
--- /dev/null
+++ b/src/specification.coffee
@@ -0,0 +1,20 @@
+module.exports = class OrSpecification
+ constructor: (left, right) ->
+ @left = left
+ @right = right
+
+ matches: (item) ->
+ @left.matches(item) || @right.matches(item)
+
+module.exports = class WhereSpecification
+ constructor: (condition) ->
+ @condition = condition
+
+ matches: (item) ->
+ for key in Object.keys(@condition)
+ return false if item[key] != @condition[key]
+ return true
+
+ or: (other_specification) ->
+ new OrSpecification(this, other_specification)
+