Method: Middleman::CoreExtensions::Data::DataStore#method_missing

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

#method_missing(path) ⇒ Hash?

"Magically" find namespaces of data if they exist

Parameters:

  • path (String)

    The namespace to search for

Returns:



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/middleman-core/core_extensions/data.rb', line 168

def method_missing(path)
  if @local_data.key?(path.to_s)
    # Any way to cache this?
    @local_data_enhanced ||= ::Middleman::Util.recursively_enhance(@local_data)
    return @local_data_enhanced[path.to_s]
  else
    result = data_for_path(path)
    return result if result
  end

  super
end