Class: Middleman::CoreExtensions::FileWatcher

Inherits:
Extension
  • Object
show all
Defined in:
middleman-core/lib/middleman-core/core_extensions/file_watcher.rb

Overview

API for watching file change events

Defined Under Namespace

Classes: API

Constant Summary

Constant Summary

Constants included from Contracts

Contracts::PATH_MATCHER, Contracts::ResourceList

Instance Attribute Summary (collapse)

Attributes inherited from Extension

#app, #options

Instance Method Summary (collapse)

Methods inherited from Extension

activated_extension, #after_build, #after_extension_activated, after_extension_activated, #before_build, clear_after_extension_callbacks, config, helpers, option

Methods included from Contracts

#Contract

Constructor Details

- (FileWatcher) initialize(app, config = {}, &block)

Returns a new instance of FileWatcher



11
12
13
# File 'middleman-core/lib/middleman-core/core_extensions/file_watcher.rb', line 11

def initialize(app, config={}, &block)
  super
end

Instance Attribute Details

- (Object) api (readonly)

Returns the value of attribute api



9
10
11
# File 'middleman-core/lib/middleman-core/core_extensions/file_watcher.rb', line 9

def api
  @api
end

Instance Method Details

- (Object) after_configuration



24
25
26
27
# File 'middleman-core/lib/middleman-core/core_extensions/file_watcher.rb', line 24

def after_configuration
  @api.reload_path('.')
  @api.is_ready = true
end

- (Object) before_configuration



17
18
19
20
21
# File 'middleman-core/lib/middleman-core/core_extensions/file_watcher.rb', line 17

def before_configuration
  @api = API.new(app)
  app.add_to_instance :files, &method(:api)
  app.add_to_config_context :files, &method(:api)
end