Method: MetaHeader#parse
- Defined in:
- lib/metaheader.rb
#parse(input) ⇒ Integer
Parse every tags found in the input up to the first newline. data following the header.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/metaheader.rb', line 49 def parse(input) if input.is_a? String input = StringIO.new input.encode universal_newline: true end @last_tag = nil @empty_lines = 0 content_offset = 0 input.each_line do |line| full_line_size = line.size # parse_line can trim the line continue = parse_line line content_offset += full_line_size if continue || line.empty? break unless continue end content_offset end |