Method: Howzit::StringUtils#extract_metadata

Defined in:
lib/howzit/stringutils.rb

#extract_metadataHash

Split the content at the first top-level header and assume everything before it is metadata. Passes to

get_metadata for processing

Returns:

  • (Hash)

    key/value pairs



277
278
279
280
281
282
283
284
# File 'lib/howzit/stringutils.rb', line 277

def 
  if File.exist?(self)
    leader = Util.read_file(self).split(/^#/)[0].strip
    leader.length > 0 ? leader. : {}
  else
    {}
  end
end