Class: CooklangRb::Metadata
- Inherits:
-
Object
- Object
- CooklangRb::Metadata
- Defined in:
- lib/cooklang_rb/metadata.rb
Constant Summary collapse
- DELIMITER =
"---"- ENTRY_PATTERN =
/^(?<key>.+?):\s*(?<value>.+)$/
Instance Method Summary collapse
-
#initialize(source) ⇒ Metadata
constructor
A new instance of Metadata.
- #parse ⇒ Object
Constructor Details
#initialize(source) ⇒ Metadata
Returns a new instance of Metadata.
8 9 10 11 |
# File 'lib/cooklang_rb/metadata.rb', line 8 def initialize(source) @source = source @metadata = {} end |
Instance Method Details
#parse ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cooklang_rb/metadata.rb', line 13 def parse if else collapse_invalid_delimiters end [@metadata, @source] end |