@@ -51,36 +51,6 @@ def to_php
51
51
end
52
52
end
53
53
54
- # we need to wrap output at 80 columns ... this output class keeps text as an
55
- # array of strings, starting a new one if the thing we append would take the
56
- # last line over @line_length
57
- class Output
58
- def initialize ( start_prefix = " * " ,
59
- cont_prefix = " * " ,
60
- line_length = 80 )
61
- @line_length = line_length
62
- @start_prefix = start_prefix
63
- @cont_prefix = cont_prefix
64
- @lines = [ ]
65
- @current_line = @start_prefix
66
- end
67
-
68
- def add ( txt )
69
- if @current_line . length + txt . length > @line_length - 1
70
- @lines << @current_line
71
- @current_line = @cont_prefix
72
- end
73
-
74
- # we could attempt to break txt, but for now assume it'll be under 80
75
- @current_line += txt
76
- end
77
-
78
- def get
79
- @lines << @current_line if @current_line . length > 0
80
- @lines . join ( "\n " )
81
- end
82
- end
83
-
84
54
def generate_operation ( op )
85
55
flags = op . flags
86
56
return if ( flags & :deprecated ) != 0
@@ -135,29 +105,26 @@ def generate_operation(op)
135
105
required_input . delete member_x
136
106
end
137
107
138
- out = Output . new
139
- out . add "@method "
140
- out . add "static " if not member_x
108
+ print " * @method "
109
+ print "static " if not member_x
141
110
if required_output . length == 0
142
- out . add "void "
111
+ print "void "
143
112
elsif required_output . length == 1
144
- out . add "#{ required_output [ 0 ] . to_php } "
113
+ print "#{ required_output [ 0 ] . to_php } "
145
114
elsif
146
- out . add "array("
147
- out . add required_output . map ( &:to_php ) . join ( ", " )
148
- out . add ") "
115
+ print "array("
116
+ print required_output . map ( &:to_php ) . join ( ", " )
117
+ print ") "
149
118
end
150
119
151
- out . add "#{ nickname } ("
120
+ print "#{ nickname } ("
152
121
153
122
required_input . each do |arg |
154
- out . add "#{ arg . to_php } $#{ arg . name } , "
123
+ print "#{ arg . to_php } $#{ arg . name } , "
155
124
end
156
- out . add "array $options = []) "
157
-
158
- out . add "#{ op . description . capitalize } ."
125
+ print "array $options = []) "
159
126
160
- puts out . get
127
+ puts " #{ op . description . capitalize } ."
161
128
end
162
129
163
130
def generate_class ( gtype )
@@ -238,10 +205,8 @@ def generate_class(gtype)
238
205
239
206
# extract_area is in there twice, once as "crop" ... do them by hand
240
207
puts <<EOF
241
- * @method Image extract_area(integer $left, integer $top, integer $width,
242
- * integer $height, array $options = []) Extract an area from an image.
243
- * @method Image crop(integer $left, integer $top, integer $width,
244
- * integer $height, array $options = []) Extract an area from an image.
208
+ * @method Image extract_area(integer $left, integer $top, integer $width, integer $height, array $options = []) Extract an area from an image.
209
+ * @method Image crop(integer $left, integer $top, integer $width, integer $height, array $options = []) Extract an area from an image.
245
210
*/
246
211
class AutoDocs
247
212
{
0 commit comments