Class: LowLoad::MarkdownAdapter
- Defined in:
- lib/adapters/markdown_adapter.rb
Constant Summary collapse
- EXTENSIONS =
['md', 'rd', 'markdown', 'raindown']
Instance Method Summary collapse
Methods inherited from Adapter
Instance Method Details
#metadata(file_path:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/adapters/markdown_adapter.rb', line 11 def (file_path:) = [] yaml_lines = [] File.foreach(file_path).with_index do |line, index| if line.strip == '---' << index + 1 break if .count > 1 else yaml_lines << line end end YAML.safe_load(yaml_lines.join, symbolize_names: true) end |