Module: Ace::Demo::Atoms::TapeMetadataParser

Defined in:
lib/ace/demo/atoms/tape_metadata_parser.rb

Class Method Summary collapse

Class Method Details

.parse(content) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ace/demo/atoms/tape_metadata_parser.rb', line 9

def parse(content)
   = {}
   = false

  content.each_line do |line|
    stripped = line.strip

    if stripped.empty?
      break if 

      next
    end

    break unless stripped.start_with?("#")

    match = stripped.match(/\A#\s*([^:]+):\s*(.*)\z/)
    next unless match

    key = normalize_key(match[1])
    [key] = match[2].strip
     = true
  end

  
end