Module: Middleman::CoreExtensions::Data::InstanceMethods

Defined in:
lib/middleman-core/core_extensions/data.rb

Overview

Instance methods

Instance Method Summary collapse

Instance Method Details

#dataDataStore

The data object

Returns:



41
42
43
# File 'lib/middleman-core/core_extensions/data.rb', line 41

def data
  @_data ||= DataStore.new(self)
end

#initializeObject

Setup data files before anything else so they are available when parsing config.rb



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/middleman-core/core_extensions/data.rb', line 26

def initialize
  self.files.changed DataStore.matcher do |file|
    self.data.touch_file(file) if file.start_with?("#{config[:data_dir]}/")
  end

  self.files.deleted DataStore.matcher do |file|
    self.data.remove_file(file) if file.start_with?("#{config[:data_dir]}/")
  end

  super
end