File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ # Parses Debian control files
1
2
class DebianControlParser
3
+ # Creates a new parser instance from either a file-like
4
+ # object or a string of multiple lines containing a
5
+ # Debian control file like Packages or Release.
6
+ #
7
+ # @param data [File,String] the object to read lines from
8
+ # @return [DebianControlParser] a parser instance
2
9
def initialize ( data )
3
10
@data = data
4
11
end
5
12
6
- # Iterator that reads a paragraph from a control file . If the file
13
+ # Iterator that returns fields from the input data . If the file
7
14
# consists of several paragraphs (seperated by empty lines)
8
15
# it must first be split by using the 'paragraphs' iterator.
16
+ #
17
+ # yield [Array<String,String>] a name/value pair for each field
9
18
def fields
10
19
return enum_for ( :each ) unless block_given?
11
20
@@ -33,6 +42,8 @@ def fields
33
42
# Iterator that splits up the input of a debian control file
34
43
# by empty lines. For example Debian "Packages" files consist
35
44
# of one paragraph for each package listed in it.
45
+ #
46
+ # yield [DebianControlParser] a parser instance that you can use .items on
36
47
def paragraphs
37
48
return enum_for ( :each ) unless block_given?
38
49
You can’t perform that action at this time.
0 commit comments