Module: Watchr

Defined in:
lib/watchr.rb,
lib/watchr/script.rb,
lib/watchr/controller.rb,
lib/watchr/event_handlers/base.rb,
lib/watchr/event_handlers/unix.rb,
lib/watchr/event_handlers/darwin.rb,
lib/watchr/event_handlers/portable.rb

Defined Under Namespace

Modules: EventHandler Classes: Controller, Script

Constant Summary collapse

VERSION =
'0.7'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.handlerClass

Detect current OS and return appropriate handler.

Examples:


Config::CONFIG['host_os'] #=> 'linux-gnu'
Watchr.handler #=> Watchr::EventHandler::Unix

Config::CONFIG['host_os'] #=> 'cygwin'
Watchr.handler #=> Watchr::EventHandler::Portable

ENV['HANDLER'] #=> 'unix'
Watchr.handler #=> Watchr::EventHandler::Unix

ENV['HANDLER'] #=> 'portable'
Watchr.handler #=> Watchr::EventHandler::Portable

Returns:

  • (Class)

    handler class for current architecture



109
110
111
# File 'lib/watchr.rb', line 109

def handler
  @handler
end

.optionsStruct

Options proxy.

Currently supported options:

  • debug Debugging state. More verbose.

Examples:


Watchr.options.debug #=> false
Watchr.options.debug = true

Returns:

  • (Struct)

    options proxy.



66
67
68
# File 'lib/watchr.rb', line 66

def options
  @options
end

Class Method Details

.debug(msg) ⇒ nil

Outputs formatted debug statement to stdout, only if ‘::options.debug` is true

Examples:


Watchr.options.debug = true
Watchr.debug('im in ur codes, notifayinin u')

#outputs: "[watchr debug] im in ur codes, notifayinin u"

Parameters:

  • message (String)

    debug message to print

Returns:

  • (nil)


86
87
88
# File 'lib/watchr.rb', line 86

def debug(msg)
  puts "[watchr debug] #{msg}" if options.debug
end

.versionObject

Deprecated.


48
49
50
# File 'lib/watchr.rb', line 48

def version #:nodoc:
  Watchr::VERSION
end