sqlpostgres 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +22 -0
  3. data/LICENSE.md +23 -0
  4. data/README.rdoc +59 -0
  5. data/Rakefile +32 -0
  6. data/VERSION +1 -0
  7. data/doc/BUGS +2 -0
  8. data/doc/examples/README +6 -0
  9. data/doc/examples/connection.rb +16 -0
  10. data/doc/examples/connection_auto.rb +22 -0
  11. data/doc/examples/connection_ctor.rb +18 -0
  12. data/doc/examples/connection_default.rb +15 -0
  13. data/doc/examples/connection_exec.rb +18 -0
  14. data/doc/examples/connection_manual.rb +12 -0
  15. data/doc/examples/connection_wrapped_new.rb +13 -0
  16. data/doc/examples/connection_wrapped_open.rb +13 -0
  17. data/doc/examples/cursor.rb +38 -0
  18. data/doc/examples/include_module.rb +9 -0
  19. data/doc/examples/include_module2.rb +12 -0
  20. data/doc/examples/insert.rb +30 -0
  21. data/doc/examples/insert2.rb +36 -0
  22. data/doc/examples/insert_bytea.rb +16 -0
  23. data/doc/examples/insert_bytea_array.rb +17 -0
  24. data/doc/examples/insert_default_values.rb +16 -0
  25. data/doc/examples/insert_insert.rb +16 -0
  26. data/doc/examples/insert_insert_default.rb +16 -0
  27. data/doc/examples/insert_insert_select.rb +20 -0
  28. data/doc/examples/insert_select.rb +20 -0
  29. data/doc/examples/interval.rb +17 -0
  30. data/doc/examples/savepoint.rb +38 -0
  31. data/doc/examples/select.rb +33 -0
  32. data/doc/examples/select2.rb +36 -0
  33. data/doc/examples/select_cross_join.rb +18 -0
  34. data/doc/examples/select_distinct.rb +18 -0
  35. data/doc/examples/select_distinct_on +19 -0
  36. data/doc/examples/select_for_update.rb +18 -0
  37. data/doc/examples/select_from.rb +17 -0
  38. data/doc/examples/select_from_subselect.rb +20 -0
  39. data/doc/examples/select_group_by.rb +19 -0
  40. data/doc/examples/select_having.rb +20 -0
  41. data/doc/examples/select_join_on.rb +18 -0
  42. data/doc/examples/select_join_using.rb +18 -0
  43. data/doc/examples/select_limit.rb +19 -0
  44. data/doc/examples/select_natural_join.rb +18 -0
  45. data/doc/examples/select_offset.rb +19 -0
  46. data/doc/examples/select_order_by.rb +20 -0
  47. data/doc/examples/select_select.rb +30 -0
  48. data/doc/examples/select_select_alias.rb +30 -0
  49. data/doc/examples/select_select_expression.rb +31 -0
  50. data/doc/examples/select_select_literal.rb +24 -0
  51. data/doc/examples/select_union.rb +21 -0
  52. data/doc/examples/select_where_array.rb +18 -0
  53. data/doc/examples/select_where_in.rb +18 -0
  54. data/doc/examples/select_where_string.rb +18 -0
  55. data/doc/examples/simple.rb +34 -0
  56. data/doc/examples/transaction.rb +30 -0
  57. data/doc/examples/transaction_abort.rb +30 -0
  58. data/doc/examples/transaction_commit.rb +34 -0
  59. data/doc/examples/translate_substitute_values.rb +17 -0
  60. data/doc/examples/update.rb +32 -0
  61. data/doc/examples/update2.rb +44 -0
  62. data/doc/examples/update_only.rb +17 -0
  63. data/doc/examples/update_set.rb +17 -0
  64. data/doc/examples/update_set_array.rb +16 -0
  65. data/doc/examples/update_set_bytea.rb +16 -0
  66. data/doc/examples/update_set_expression.rb +16 -0
  67. data/doc/examples/update_set_subselect.rb +20 -0
  68. data/doc/examples/update_where.rb +17 -0
  69. data/doc/examples/use_prefix.rb +8 -0
  70. data/doc/examples/use_prefix2.rb +11 -0
  71. data/doc/index.html +31 -0
  72. data/doc/insertexamples.rb +9 -0
  73. data/doc/makemanual +4 -0
  74. data/doc/makerdoc +5 -0
  75. data/doc/manual.dbk +622 -0
  76. data/lib/sqlpostgres/Connection.rb +198 -0
  77. data/lib/sqlpostgres/Cursor.rb +157 -0
  78. data/lib/sqlpostgres/Delete.rb +67 -0
  79. data/lib/sqlpostgres/Exceptions.rb +15 -0
  80. data/lib/sqlpostgres/Insert.rb +279 -0
  81. data/lib/sqlpostgres/NullConnection.rb +22 -0
  82. data/lib/sqlpostgres/PgBit.rb +73 -0
  83. data/lib/sqlpostgres/PgBox.rb +37 -0
  84. data/lib/sqlpostgres/PgCidr.rb +21 -0
  85. data/lib/sqlpostgres/PgCircle.rb +75 -0
  86. data/lib/sqlpostgres/PgInet.rb +21 -0
  87. data/lib/sqlpostgres/PgInterval.rb +208 -0
  88. data/lib/sqlpostgres/PgLineSegment.rb +37 -0
  89. data/lib/sqlpostgres/PgMacAddr.rb +21 -0
  90. data/lib/sqlpostgres/PgPath.rb +64 -0
  91. data/lib/sqlpostgres/PgPoint.rb +65 -0
  92. data/lib/sqlpostgres/PgPolygon.rb +56 -0
  93. data/lib/sqlpostgres/PgTime.rb +77 -0
  94. data/lib/sqlpostgres/PgTimeWithTimeZone.rb +98 -0
  95. data/lib/sqlpostgres/PgTimestamp.rb +93 -0
  96. data/lib/sqlpostgres/PgTwoPoints.rb +54 -0
  97. data/lib/sqlpostgres/PgType.rb +34 -0
  98. data/lib/sqlpostgres/PgWrapper.rb +41 -0
  99. data/lib/sqlpostgres/Savepoint.rb +98 -0
  100. data/lib/sqlpostgres/Select.rb +855 -0
  101. data/lib/sqlpostgres/Transaction.rb +120 -0
  102. data/lib/sqlpostgres/Translate.rb +436 -0
  103. data/lib/sqlpostgres/Update.rb +188 -0
  104. data/lib/sqlpostgres.rb +67 -0
  105. data/test/Assert.rb +72 -0
  106. data/test/Connection.test.rb +246 -0
  107. data/test/Cursor.test.rb +190 -0
  108. data/test/Delete.test.rb +68 -0
  109. data/test/Insert.test.rb +123 -0
  110. data/test/MockPGconn.rb +62 -0
  111. data/test/NullConnection.test.rb +32 -0
  112. data/test/PgBit.test.rb +98 -0
  113. data/test/PgBox.test.rb +108 -0
  114. data/test/PgCidr.test.rb +61 -0
  115. data/test/PgCircle.test.rb +107 -0
  116. data/test/PgInet.test.rb +61 -0
  117. data/test/PgInterval.test.rb +180 -0
  118. data/test/PgLineSegment.test.rb +108 -0
  119. data/test/PgMacAddr.test.rb +61 -0
  120. data/test/PgPath.test.rb +106 -0
  121. data/test/PgPoint.test.rb +100 -0
  122. data/test/PgPolygon.test.rb +95 -0
  123. data/test/PgTime.test.rb +120 -0
  124. data/test/PgTimeWithTimeZone.test.rb +117 -0
  125. data/test/PgTimestamp.test.rb +134 -0
  126. data/test/RandomThings.rb +25 -0
  127. data/test/Savepoint.test.rb +286 -0
  128. data/test/Select.test.rb +930 -0
  129. data/test/Test.rb +62 -0
  130. data/test/TestConfig.rb +21 -0
  131. data/test/TestSetup.rb +13 -0
  132. data/test/TestUtil.rb +92 -0
  133. data/test/Transaction.test.rb +275 -0
  134. data/test/Translate.test.rb +354 -0
  135. data/test/Update.test.rb +227 -0
  136. data/test/roundtrip.test.rb +565 -0
  137. data/test/test +34 -0
  138. data/tools/exampleinserter/ExampleInserter.rb +177 -0
  139. data/tools/rdoc/ChangeLog +796 -0
  140. data/tools/rdoc/EXAMPLE.rb +48 -0
  141. data/tools/rdoc/MANIFEST +58 -0
  142. data/tools/rdoc/Makefile +27 -0
  143. data/tools/rdoc/NEW_FEATURES +226 -0
  144. data/tools/rdoc/README +390 -0
  145. data/tools/rdoc/ToDo +6 -0
  146. data/tools/rdoc/contrib/Index +6 -0
  147. data/tools/rdoc/contrib/xslfo/ChangeLog +181 -0
  148. data/tools/rdoc/contrib/xslfo/README +106 -0
  149. data/tools/rdoc/contrib/xslfo/TODO +10 -0
  150. data/tools/rdoc/contrib/xslfo/convert.xsl +151 -0
  151. data/tools/rdoc/contrib/xslfo/demo/README +21 -0
  152. data/tools/rdoc/contrib/xslfo/demo/rdocfo +99 -0
  153. data/tools/rdoc/contrib/xslfo/fcm.xsl +54 -0
  154. data/tools/rdoc/contrib/xslfo/files.xsl +62 -0
  155. data/tools/rdoc/contrib/xslfo/labeled-lists.xsl +66 -0
  156. data/tools/rdoc/contrib/xslfo/lists.xsl +44 -0
  157. data/tools/rdoc/contrib/xslfo/modules.xsl +152 -0
  158. data/tools/rdoc/contrib/xslfo/rdoc.xsl +75 -0
  159. data/tools/rdoc/contrib/xslfo/source.xsl +66 -0
  160. data/tools/rdoc/contrib/xslfo/styles.xsl +69 -0
  161. data/tools/rdoc/contrib/xslfo/tables.xsl +67 -0
  162. data/tools/rdoc/contrib/xslfo/utils.xsl +21 -0
  163. data/tools/rdoc/debian/changelog +33 -0
  164. data/tools/rdoc/debian/compat +1 -0
  165. data/tools/rdoc/debian/control +20 -0
  166. data/tools/rdoc/debian/copyright +10 -0
  167. data/tools/rdoc/debian/dirs +2 -0
  168. data/tools/rdoc/debian/docs +2 -0
  169. data/tools/rdoc/debian/rdoc.1 +252 -0
  170. data/tools/rdoc/debian/rdoc.manpages +1 -0
  171. data/tools/rdoc/debian/rdoc.pod +149 -0
  172. data/tools/rdoc/debian/rules +9 -0
  173. data/tools/rdoc/dot/dot.rb +255 -0
  174. data/tools/rdoc/etc/rdoc.dtd +203 -0
  175. data/tools/rdoc/install.rb +137 -0
  176. data/tools/rdoc/markup/install.rb +43 -0
  177. data/tools/rdoc/markup/sample/sample.rb +42 -0
  178. data/tools/rdoc/markup/simple_markup/fragments.rb +323 -0
  179. data/tools/rdoc/markup/simple_markup/inline.rb +348 -0
  180. data/tools/rdoc/markup/simple_markup/lines.rb +147 -0
  181. data/tools/rdoc/markup/simple_markup/preprocess.rb +68 -0
  182. data/tools/rdoc/markup/simple_markup/to_html.rb +281 -0
  183. data/tools/rdoc/markup/simple_markup.rb +474 -0
  184. data/tools/rdoc/markup/test/AllTests.rb +2 -0
  185. data/tools/rdoc/markup/test/TestInline.rb +151 -0
  186. data/tools/rdoc/markup/test/TestParse.rb +411 -0
  187. data/tools/rdoc/rdoc/code_objects.rb +536 -0
  188. data/tools/rdoc/rdoc/diagram.rb +331 -0
  189. data/tools/rdoc/rdoc/generators/chm_generator.rb +112 -0
  190. data/tools/rdoc/rdoc/generators/html_generator.rb +1268 -0
  191. data/tools/rdoc/rdoc/generators/template/chm/chm.rb +86 -0
  192. data/tools/rdoc/rdoc/generators/template/html/html.rb +705 -0
  193. data/tools/rdoc/rdoc/generators/template/html/kilmer.rb +377 -0
  194. data/tools/rdoc/rdoc/generators/template/xml/rdf.rb +110 -0
  195. data/tools/rdoc/rdoc/generators/template/xml/xml.rb +110 -0
  196. data/tools/rdoc/rdoc/generators/xml_generator.rb +130 -0
  197. data/tools/rdoc/rdoc/options.rb +451 -0
  198. data/tools/rdoc/rdoc/parsers/parse_c.rb +287 -0
  199. data/tools/rdoc/rdoc/parsers/parse_f95.rb +118 -0
  200. data/tools/rdoc/rdoc/parsers/parse_rb.rb +2311 -0
  201. data/tools/rdoc/rdoc/parsers/parse_simple.rb +37 -0
  202. data/tools/rdoc/rdoc/parsers/parserfactory.rb +75 -0
  203. data/tools/rdoc/rdoc/rdoc.rb +219 -0
  204. data/tools/rdoc/rdoc/template.rb +234 -0
  205. data/tools/rdoc/rdoc/tokenstream.rb +25 -0
  206. data/tools/rdoc/rdoc.rb +9 -0
  207. metadata +291 -0
@@ -0,0 +1,149 @@
1
+ =head1 NAME
2
+
3
+ rdoc - Generate documentation from ruby source files
4
+
5
+ =head1 SYNOPSIS
6
+
7
+ Usage:
8
+
9
+ rdoc [options] [names...]
10
+
11
+ =head1 DESCRIPTION
12
+
13
+ Files are parsed, and the information they contain
14
+ collected, before any output is produced. This allows cross
15
+ references between all files to be resolved. If a name is a
16
+ directory, it is traversed. If no names are specified, all
17
+ Ruby files in the current directory (and subdirectories) are
18
+ processed.
19
+
20
+ =head1 OPTIONS
21
+
22
+ Options:
23
+
24
+ =over 8
25
+
26
+ =item B<-a>, B<--all>
27
+
28
+ include all methods (not just public) in the output
29
+
30
+ =item B<-c> I<charset>, B<--charset> I<charset>
31
+
32
+ specifies HTML character-set
33
+
34
+ =item B<-D>, B<--debug>
35
+
36
+ displays lots on internal stuff
37
+
38
+ =item B<-d>, B<--diagram>
39
+
40
+ Generate diagrams showing modules and classes.
41
+ You need dot V1.8.6 or later to use the --diagram
42
+ option correctly. Dot is available from
43
+ http://www.research.att.com/sw/tools/graphviz/
44
+
45
+ =item B<-x> I<pattern>, B<--exclude> I<pattern>
46
+
47
+ do not process files or directories matching
48
+ pattern. Files given explicitly on the command
49
+ line will never be excluded.
50
+
51
+ =item B<-F>, B<--fileboxes>
52
+
53
+ classes are put in boxes which represents
54
+ files, where these classes reside. Classes
55
+ shared between more than one file are
56
+ shown with list of files that sharing them.
57
+ Silently discarded if --diagram is not given
58
+ Experimental.
59
+
60
+ =item B<-f> I<format_name>, B<--fmt> I<format_name>
61
+
62
+ set the output formatter (see below)
63
+
64
+ =item B<-h>, B<--help>
65
+
66
+ print out a brief help summary
67
+
68
+ =item B<-O>, B<--help-output>
69
+
70
+ explain the various output options
71
+
72
+ =item B<-I> I<gif|jpg|jpg|jpeg>, B<--image-format> I<gif|png|jpg|jpeg>
73
+
74
+ Sets output image format for diagrams. Can
75
+ be png, gif, jpeg, jpg. If this option is
76
+ omitted, png is used. Requires --diagram.
77
+
78
+ =item B<-i> I<dir[,dir,...]>, B<--include> I<dir[,dir,...]>
79
+
80
+ set (or add to) the list of directories
81
+ to be searched when satisfying :include:
82
+ requests. Can be used more than once.
83
+
84
+ =item B<-S>, B<--inline-source>
85
+
86
+ Show method source code inline, rather
87
+ than via a popup link
88
+
89
+ =item B<-N>, B<--line-numbers>
90
+
91
+ Include line numbers in the source code
92
+
93
+ =item B<-m> I<name>, B<--main> I<name>
94
+
95
+ 'name' will be the initial page displayed
96
+
97
+ =item B<-1>, B<--one-file>
98
+
99
+ put all the output into a single file
100
+
101
+ =item B<-o> I<dir>, B<--op> I<dir>
102
+
103
+ set the output directory
104
+
105
+ =item B<-n> I<name>, B<--opname> I<name>
106
+
107
+ Set the 'name' of the output. Has no
108
+ effect for HTML.
109
+
110
+ =item B<-q>, B<--quiet>
111
+
112
+ don't show progress as we parse
113
+
114
+ =item B<-H>, B<--show-hash>
115
+
116
+ A name of the form #name in a comment
117
+ is a possible hyperlink to an instance
118
+ method name. When displayed, the '#' is
119
+ removed unless this option is specified
120
+
121
+ =item B<-w> I<width>, B<--tab-width> I<width>
122
+
123
+ Set the width of tab characters (default 8)
124
+
125
+ =item B<-T> I<template_name>, B<--template> I<template_name>
126
+
127
+ Set the template used when generating output
128
+
129
+ =item B<-t> I<text>, B<--title> I<text>
130
+
131
+ Set 'txt' as the title for the output
132
+
133
+ =item B<-v>, B<--version>
134
+
135
+ display RDoc's version
136
+
137
+ =back
138
+
139
+ =head1 NOTES
140
+
141
+ Available output formatters: chm, html, xml
142
+
143
+ For information on where the output goes, use
144
+
145
+ rdoc --help-output
146
+
147
+ =head1 AUTHOR
148
+
149
+ This manpage was contributed by Brian Almeida <bma@debian.org>
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/make -f
2
+
3
+ include /usr/share/cdbs/1/rules/debhelper.mk
4
+
5
+
6
+ common-install-arch common-install-indep:: common-install-impl
7
+ common-install-impl::
8
+ DESTDIR=$(CURDIR)/debian/rdoc ruby install.rb
9
+ chmod a+x $(CURDIR)/debian/rdoc/usr/lib/ruby/1.6/rdoc/parsers/parse_rb.rb
@@ -0,0 +1,255 @@
1
+ module DOT
2
+
3
+ # these glogal vars are used to make nice graph source
4
+ $tab = ' '
5
+ $tab2 = $tab * 2
6
+
7
+ # if we don't like 4 spaces, we can change it any time
8
+ def change_tab( t )
9
+ $tab = t
10
+ $tab2 = t * 2
11
+ end
12
+
13
+ # options for node declaration
14
+ NODE_OPTS = [
15
+ 'bgcolor',
16
+ 'color',
17
+ 'fontcolor',
18
+ 'fontname',
19
+ 'fontsize',
20
+ 'height',
21
+ 'width',
22
+ 'label',
23
+ 'layer',
24
+ 'rank',
25
+ 'shape',
26
+ 'shapefile',
27
+ 'style',
28
+ 'URL',
29
+ ]
30
+
31
+ # options for edge declaration
32
+ EDGE_OPTS = [
33
+ 'color',
34
+ 'decorate',
35
+ 'dir',
36
+ 'fontcolor',
37
+ 'fontname',
38
+ 'fontsize',
39
+ 'id',
40
+ 'label',
41
+ 'layer',
42
+ 'lhead',
43
+ 'ltail',
44
+ 'minlen',
45
+ 'style',
46
+ 'weight'
47
+ ]
48
+
49
+ # options for graph declaration
50
+ GRAPH_OPTS = [
51
+ 'bgcolor',
52
+ 'center',
53
+ 'clusterrank',
54
+ 'color',
55
+ 'compound',
56
+ 'concentrate',
57
+ 'fillcolor',
58
+ 'fontcolor',
59
+ 'fontname',
60
+ 'fontsize',
61
+ 'label',
62
+ 'layerseq',
63
+ 'margin',
64
+ 'mclimit',
65
+ 'nodesep',
66
+ 'nslimit',
67
+ 'ordering',
68
+ 'orientation',
69
+ 'page',
70
+ 'rank',
71
+ 'rankdir',
72
+ 'ranksep',
73
+ 'ratio',
74
+ 'size',
75
+ 'style',
76
+ 'URL'
77
+ ]
78
+
79
+ # a root class for any element in dot notation
80
+ class DOTSimpleElement
81
+ attr_accessor :name
82
+
83
+ def initialize( params = {} )
84
+ @label = params['name'] ? params['name'] : ''
85
+ end
86
+
87
+ def to_s
88
+ @name
89
+ end
90
+ end
91
+
92
+ # an element that has options ( node, edge or graph )
93
+ class DOTElement < DOTSimpleElement
94
+ #attr_reader :parent
95
+ attr_accessor :name, :options
96
+
97
+ def initialize( params = {}, option_list = [] )
98
+ super( params )
99
+ @name = params['name'] ? params['name'] : nil
100
+ @parent = params['parent'] ? params['parent'] : nil
101
+ @options = {}
102
+ option_list.each{ |i|
103
+ @options[i] = params[i] if params[i]
104
+ }
105
+ @options['label'] ||= @name if @name != 'node'
106
+ end
107
+
108
+ def each_option
109
+ @options.each{ |i| yield i }
110
+ end
111
+
112
+ def each_option_pair
113
+ @options.each_pair{ |key, val| yield key, val }
114
+ end
115
+
116
+ #def parent=( thing )
117
+ # @parent.delete( self ) if defined?( @parent ) and @parent
118
+ # @parent = thing
119
+ #end
120
+ end
121
+
122
+
123
+ # this is used when we build nodes that have shape=record
124
+ # ports don't have options :)
125
+ class DOTPort < DOTSimpleElement
126
+ attr_accessor :label
127
+
128
+ def initialize( params = {} )
129
+ super( params )
130
+ @name = params['label'] ? params['label'] : ''
131
+ end
132
+ def to_s
133
+ ( @name && @name != "" ? "<#{@name}>" : "" ) + "#{@label}"
134
+ end
135
+ end
136
+
137
+ # node element
138
+ class DOTNode < DOTElement
139
+
140
+ def initialize( params = {}, option_list = NODE_OPTS )
141
+ super( params, option_list )
142
+ @ports = params['ports'] ? params['ports'] : []
143
+ end
144
+
145
+ def each_port
146
+ @ports.each{ |i| yield i }
147
+ end
148
+
149
+ def << ( thing )
150
+ @ports << thing
151
+ end
152
+
153
+ def push ( thing )
154
+ @ports.push( thing )
155
+ end
156
+
157
+ def pop
158
+ @ports.pop
159
+ end
160
+
161
+ def to_s( t = '' )
162
+
163
+ label = @options['shape'] != 'record' && @ports.length == 0 ?
164
+ @options['label'] ?
165
+ t + $tab + "label = \"#{@options['label']}\"\n" :
166
+ '' :
167
+ t + $tab + 'label = "' + " \\\n" +
168
+ t + $tab2 + "#{@options['label']}| \\\n" +
169
+ @ports.collect{ |i|
170
+ t + $tab2 + i.to_s
171
+ }.join( "| \\\n" ) + " \\\n" +
172
+ t + $tab + '"' + "\n"
173
+
174
+ t + "#{@name} [\n" +
175
+ @options.to_a.collect{ |i|
176
+ i[1] && i[0] != 'label' ?
177
+ t + $tab + "#{i[0]} = #{i[1]}" : nil
178
+ }.compact.join( ",\n" ) + ( label != '' ? ",\n" : "\n" ) +
179
+ label +
180
+ t + "]\n"
181
+ end
182
+ end
183
+
184
+ # subgraph element is the same to graph, but has another header in dot
185
+ # notation
186
+ class DOTSubgraph < DOTElement
187
+
188
+ def initialize( params = {}, option_list = GRAPH_OPTS )
189
+ super( params, option_list )
190
+ @nodes = params['nodes'] ? params['nodes'] : []
191
+ @dot_string = 'subgraph'
192
+ end
193
+
194
+ def each_node
195
+ @nodes.each{ |i| yield i }
196
+ end
197
+
198
+ def << ( thing )
199
+ @nodes << thing
200
+ end
201
+
202
+ def push( thing )
203
+ @nodes.push( thing )
204
+ end
205
+
206
+ def pop
207
+ @nodes.pop
208
+ end
209
+
210
+ def to_s( t = '' )
211
+ hdr = t + "#{@dot_string} #{@name} {\n"
212
+
213
+ options = @options.to_a.collect{ |name, val|
214
+ val && name != 'label' ?
215
+ t + $tab + "#{name} = #{val}" :
216
+ name ? t + $tab + "#{name} = \"#{val}\"" : nil
217
+ }.compact.join( "\n" ) + "\n"
218
+
219
+ nodes = @nodes.collect{ |i|
220
+ i.to_s( t + $tab )
221
+ }.join( "\n" ) + "\n"
222
+ hdr + options + nodes + t + "}\n"
223
+ end
224
+ end
225
+
226
+ # this is graph
227
+ class DOTDigraph < DOTSubgraph
228
+ def initialize( params = {}, option_list = GRAPH_OPTS )
229
+ super( params, option_list )
230
+ @dot_string = 'digraph'
231
+ end
232
+ end
233
+
234
+ # this is edge
235
+ class DOTEdge < DOTElement
236
+ attr_accessor :from, :to
237
+ def initialize( params = {}, option_list = EDGE_OPTS )
238
+ super( params, option_list )
239
+ @from = params['from'] ? params['from'] : nil
240
+ @to = params['to'] ? params['to'] : nil
241
+ end
242
+
243
+ def to_s( t = '' )
244
+ t + "#{@from} -> #{to} [\n" +
245
+ @options.to_a.collect{ |i|
246
+ i[1] && i[0] != 'label' ?
247
+ t + $tab + "#{i[0]} = #{i[1]}" :
248
+ i[1] ? t + $tab + "#{i[0]} = \"#{i[1]}\"" : nil
249
+ }.compact.join( "\n" ) + "\n" + t + "]\n"
250
+ end
251
+ end
252
+ end
253
+
254
+
255
+
@@ -0,0 +1,203 @@
1
+ <!--
2
+ This is the DTD for the XML produced by the RDoc package.
3
+
4
+ Some conventions:
5
+
6
+ Cross references:
7
+ - targets are labeled using id="..." attributes
8
+ - references use conventional <a href="...">...</a> notation
9
+
10
+
11
+ -->
12
+
13
+
14
+ <!-- ==================== common entities ======================== -->
15
+
16
+ <!ENTITY % idattr
17
+ "id CDATA #IMPLIED"
18
+ >
19
+
20
+ <!ENTITY % name-id
21
+ "id CDATA #IMPLIED
22
+ name CDATA #REQUIRED"
23
+ >
24
+
25
+ <!-- a name or a reference to a name -->
26
+
27
+ <!ENTITY % aref "(#PCDATA | a)*">
28
+
29
+ <!-- the contents of a markup section -->
30
+
31
+ <!ENTITY % markup.attrs "b | tt | em">
32
+
33
+ <!ENTITY % markup.lists "ul | ol | dl | table ">
34
+
35
+ <!ENTITY % markup.heading "h1 | h2 | h3 | h4 | h5 | h6 ">
36
+
37
+ <!ENTITY % markup.internal "#PCDATA | p | a | pre | hr | %markup.attrs; | %markup.lists;">
38
+
39
+ <!ENTITY % flow "(#PCDATA | %markup.attrs;)*">
40
+
41
+ <!ENTITY % markup "(%markup.internal;)*">
42
+
43
+ <!ENTITY % toplevel "(%markup.internal; | %markup.heading;)*">
44
+
45
+ <!-- ================== document structure ======================= -->
46
+
47
+ <!ELEMENT rdoc (file-list?, class-module-list?)>
48
+
49
+ <!-- ================== file-list ================================
50
+
51
+ A file list contains a <file> entry for every source file
52
+ processed.
53
+
54
+ -->
55
+
56
+ <!ELEMENT file-list (file*)>
57
+
58
+ <!ELEMENT file (file-info, description?, contents)>
59
+ <!ATTLIST file %name-id;>
60
+
61
+
62
+ <!ELEMENT file-info (path, dtm-modified)>
63
+
64
+ <!-- the full path to the file -->
65
+
66
+ <!ELEMENT path (#PCDATA)>
67
+
68
+ <!-- last modified dtms of file -->
69
+
70
+ <!ELEMENT dtm-modified (#PCDATA)>
71
+
72
+
73
+ <!-- =================== class list ======================== -->
74
+
75
+ <!ELEMENT class-module-list (Class|Module)*>
76
+
77
+ <!ELEMENT Class (classmod-info, description?, contents)>
78
+ <!ATTLIST Class %name-id;>
79
+
80
+ <!ELEMENT Module (classmod-info, description?, contents)>
81
+ <!ATTLIST Module %name-id;>
82
+
83
+ <!ELEMENT classmod-info (infiles?, superclass?)>
84
+
85
+ <!ELEMENT infiles (infile*)>
86
+
87
+ <!ELEMENT infile %aref;>
88
+
89
+ <!ELEMENT superclass %aref;>
90
+
91
+
92
+ <!-- ==================== description =========================== -->
93
+
94
+ <!ELEMENT description %toplevel;>
95
+
96
+ <!-- ==================== contents ==============================
97
+
98
+ These are the contents, shared between files and classes
99
+
100
+ -->
101
+
102
+ <!ELEMENT contents (required-file-list?,
103
+ attribute-list?,
104
+ included-module-list?,
105
+ method-list?)>
106
+
107
+ <!ELEMENT required-file-list (required-file*)>
108
+
109
+ <!ELEMENT required-file EMPTY>
110
+ <!ATTLIST required-file
111
+ name CDATA #REQUIRED
112
+ href CDATA #IMPLIED
113
+ >
114
+
115
+ <!ELEMENT attribute-list (attribute*)>
116
+
117
+ <!ELEMENT attribute (attribute-rw, description)>
118
+ <!ATTLIST attribute
119
+ name CDATA #REQUIRED
120
+ >
121
+
122
+ <!ELEMENT attribute-name (#PCDATA)>
123
+ <!ELEMENT attribute-rw (#PCDATA)>
124
+
125
+ <!ELEMENT included-module-list (included-module*)>
126
+
127
+ <!ELEMENT included-module EMPTY>
128
+ <!ATTLIST included-module
129
+ name CDATA #REQUIRED
130
+ href CDATA #IMPLIED
131
+ >
132
+
133
+ <!ELEMENT method-list (method*)>
134
+
135
+ <!ELEMENT method (parameters, description?, source-code-listing?)>
136
+ <!ATTLIST method
137
+ name CDATA #REQUIRED
138
+ id CDATA #REQUIRED
139
+ type (Public | Private | Protected) #REQUIRED
140
+ category (Instance | Class) #REQUIRED
141
+ >
142
+
143
+ <!ELEMENT parameters (#PCDATA)>
144
+
145
+ <!ELEMENT source-code-listing (#PCDATA | span)*>
146
+
147
+ <!-- for marking up code
148
+ kw - keyword
149
+ cmt - comment
150
+ str - string
151
+ re - regexp
152
+ -->
153
+
154
+ <!ELEMENT span (#PCDATA)>
155
+ <!ATTLIST span
156
+ class (kw | cmt | str | re) #REQUIRED
157
+ >
158
+
159
+ <!-- ================== cross references ================== -->
160
+
161
+ <!ELEMENT a (#PCDATA)>
162
+ <!ATTLIST a
163
+ href CDATA #REQUIRED
164
+ >
165
+
166
+ <!-- ================== markup ============================ -->
167
+
168
+ <!ELEMENT p %markup;>
169
+
170
+ <!ELEMENT h1 %flow;>
171
+ <!ELEMENT h2 %flow;>
172
+ <!ELEMENT h3 %flow;>
173
+ <!ELEMENT h4 %flow;>
174
+ <!ELEMENT h5 %flow;>
175
+ <!ELEMENT h6 %flow;>
176
+
177
+ <!ELEMENT b %markup;>
178
+ <!ELEMENT tt %markup;>
179
+ <!ELEMENT em %markup;>
180
+
181
+ <!ELEMENT pre (#PCDATA)>
182
+
183
+ <!ELEMENT hr EMPTY>
184
+ <!ATTLIST hr
185
+ size CDATA #IMPLIED
186
+ >
187
+
188
+
189
+ <!ELEMENT ul (li*)>
190
+ <!ELEMENT ol (li*)>
191
+ <!ELEMENT li %markup;>
192
+ <!ELEMENT dl (dt|dd)+>
193
+ <!ELEMENT dt %markup;>
194
+ <!ELEMENT dd %markup;>
195
+
196
+ <!ELEMENT table (tr)+>
197
+
198
+ <!ELEMENT tr (td)+>
199
+
200
+ <!ELEMENT td %markup;>
201
+ <!ATTLIST td
202
+ valign CDATA #FIXED "top"
203
+ >