Class: Nesta::FileModel

Inherits:
Object
  • Object
show all
Defined in:
lib/nesta-plugin-yaml-metadata/init.rb

Instance Method Summary collapse

Instance Method Details

#parse_metadata(first_paragraph) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/nesta-plugin-yaml-metadata/init.rb', line 5

def (first_paragraph)
  yaml = YAML.load(first_paragraph)
rescue Psych::SyntaxError
  raise MetadataParseError
else
  raise MetadataParseError unless yaml
   = CaseInsensitiveHash.new
  yaml.each { |key, value| [key.downcase] = value } if yaml
  
end