Skip to content

Commit 952bc7d

Browse files
committed
Added Yardoc-style code documentation
1 parent 3bd0995 commit 952bc7d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/debian_control_parser.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
# Parses Debian control files
12
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
29
def initialize(data)
310
@data = data
411
end
512

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
714
# consists of several paragraphs (seperated by empty lines)
815
# it must first be split by using the 'paragraphs' iterator.
16+
#
17+
# yield [Array<String,String>] a name/value pair for each field
918
def fields
1019
return enum_for(:each) unless block_given?
1120

@@ -33,6 +42,8 @@ def fields
3342
# Iterator that splits up the input of a debian control file
3443
# by empty lines. For example Debian "Packages" files consist
3544
# of one paragraph for each package listed in it.
45+
#
46+
# yield [DebianControlParser] a parser instance that you can use .items on
3647
def paragraphs
3748
return enum_for(:each) unless block_given?
3849

0 commit comments

Comments
 (0)