Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The controller is responsible for parsing the script, to let callers …

…setup script options.
  • Loading branch information...
commit 2ef28600d517199212ef8ea1496e4ce97b4f18c6 1 parent 61d345b
François Beausoleil authored
2  vendor/watchr-0.5.7/lib/watchr/controller.rb
View
@@ -25,6 +25,7 @@ class Controller
def initialize(script, handler)
@script = script
@handler = handler
+
@handler.add_observer(self)
Watchr.debug "using %s handler" % handler.class.name
@@ -35,6 +36,7 @@ def initialize(script, handler)
# Will block control flow until application is explicitly stopped/killed.
#
def run
+ @script.parse!
@handler.listen(monitored_paths)
end
4 vendor/watchr-0.5.7/lib/watchr/script.rb
View
@@ -26,8 +26,7 @@ class API #:nodoc:
# Creates a script object for <tt>path</tt>.
#
- # Will also immediatly parse the script so it is ready to be passed to a
- # controller.
+ # Does not parse the script. The controller knows when to parse the script.
#
# ===== Parameters
# path<Pathname>:: the path to the script
@@ -36,7 +35,6 @@ def initialize(path)
@path = path
@rules = []
@default_action = lambda {}
- parse!
end
# Main script API method. Builds a new rule, binding a pattern to an action.
Please sign in to comment.
Something went wrong with that request. Please try again.