tree.rb 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/examples/ruby_examples/find_directory_without_subdirectory.rb +2 -2
- data/examples/ruby_examples/find_files.rb +4 -5
- data/examples/ruby_examples/print_files.rb +14 -2
- data/lib/tree_rb.rb +17 -15
- data/lib/tree_rb/cli/cli_tree.rb +32 -37
- data/lib/tree_rb/{abs_node.rb → core/abs_node.rb} +0 -1
- data/lib/tree_rb/{basic_tree_node_visitor.rb → core/basic_tree_node_visitor.rb} +0 -0
- data/lib/tree_rb/{leaf_node.rb → core/leaf_node.rb} +0 -0
- data/lib/tree_rb/{tree_node.rb → core/tree_node.rb} +1 -0
- data/lib/tree_rb/{tree_node_visitor.rb → core/tree_node_visitor.rb} +0 -0
- data/lib/tree_rb/exception.rb +7 -0
- data/lib/tree_rb/{util → input_file_system}/dir_processor.rb +0 -0
- data/lib/tree_rb/{directory_walker.rb → input_file_system/directory_walker.rb} +3 -3
- data/lib/tree_rb/input_html_page/dom_walker.rb +36 -0
- data/lib/tree_rb/output_dircat/dircat_helper.rb +24 -0
- data/lib/tree_rb/output_dircat/dircat_visitor.rb +78 -0
- data/lib/tree_rb/output_dircat/entry.rb +65 -0
- data/lib/tree_rb/{d3js_helper.rb → output_html/d3js_helper.rb} +10 -2
- data/lib/tree_rb/output_html/directory_to_hash2_visitor.rb +105 -0
- data/lib/tree_rb/{erb_render.rb → output_html/erb_render.rb} +0 -0
- data/lib/tree_rb/{visitors → output_sqlite}/sqlite_dir_tree_visitor.rb +0 -1
- data/lib/tree_rb/output_sqlite/sqlite_helper.rb +29 -0
- data/lib/tree_rb/version.rb +1 -1
- data/lib/tree_rb/visitors/callback_tree_node_visitor2.rb +0 -1
- data/lib/tree_rb/visitors/clone_tree_node_visitor.rb +0 -1
- data/lib/tree_rb/visitors/depth_tree_node_visitor.rb +0 -1
- data/lib/tree_rb/visitors/{flat_print_tree_node_visitors.rb → flat_print_tree_node_visitor.rb} +0 -0
- data/lib/tree_rb/{visitors → visitors_file_system}/build_dir_tree_visitor.rb +0 -0
- data/lib/tree_rb/{visitors → visitors_file_system}/directory_to_hash_visitor.rb +0 -0
- data/lib/tree_rb_cli.rb +0 -2
- data/spec/fixtures/html_pages/test_1.html +22 -0
- data/spec/fixtures/tmp/dircat +34 -0
- data/spec/tree_rb/cli/cli_tree_generic_spec.rb +2 -2
- data/spec/tree_rb/{tree_dsl_spec.rb → core/tree_dsl_spec.rb} +3 -3
- data/spec/tree_rb/{tree_dsl_with_derived_class1_spec.rb → core/tree_dsl_with_derived_class1_spec.rb} +1 -1
- data/spec/tree_rb/{tree_dsl_with_derived_class_spec.rb → core/tree_dsl_with_derived_class_spec.rb} +1 -1
- data/spec/tree_rb/{tree_node_paths_spec.rb → core/tree_node_paths_spec.rb} +2 -2
- data/spec/tree_rb/{tree_node_spec.rb → core/tree_node_spec.rb} +1 -1
- data/spec/tree_rb/{tree_node_visitor_delegate_spec.rb → core/tree_node_visitor_delegate_spec.rb} +1 -1
- data/spec/tree_rb/{tree_node_visitor_dsl_spec.rb → core/tree_node_visitor_dsl_spec.rb} +1 -1
- data/spec/tree_rb/{util → input_file_system}/dir_processor_spec.rb +2 -2
- data/spec/tree_rb/{directory_walker_spec.rb → input_file_system/directory_walker_spec.rb} +11 -12
- data/spec/tree_rb/input_html_page/dom_walker_spec.rb +18 -0
- data/tree.rb.gemspec +12 -11
- metadata +95 -79
- data/lib/tree_rb/visitors/directory_to_hash2_visitor.rb +0 -418
- data/spec/fixtures/test_dir_1/.dir_with_dot/dummy.txt +0 -1
- data/spec/fixtures/test_dir_2/[Dsube]/sub/.gitkeep +0 -0
@@ -1,418 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module TreeRb
|
4
|
-
|
5
|
-
#{
|
6
|
-
# "name": "flare",
|
7
|
-
# "children": [
|
8
|
-
# {
|
9
|
-
# "name": "analytics1",
|
10
|
-
# "children": [
|
11
|
-
# {
|
12
|
-
# "name": "cluster",
|
13
|
-
# "children": [
|
14
|
-
# {"name": "AgglomerativeCluster", "size": 3938},
|
15
|
-
# {"name": "CommunityStructure", "size": 3812},
|
16
|
-
# {"name": "HierarchicalCluster", "size": 6714},
|
17
|
-
# {"name": "MergeEdge", "size": 743}
|
18
|
-
# ]
|
19
|
-
# },
|
20
|
-
# {
|
21
|
-
# "name": "graph",
|
22
|
-
# "children": [
|
23
|
-
# {"name": "BetweennessCentrality", "size": 3534},
|
24
|
-
# {"name": "LinkDistance", "size": 5731},
|
25
|
-
# {"name": "MaxFlowMinCut", "size": 7840},
|
26
|
-
# {"name": "ShortestPaths", "size": 5914},
|
27
|
-
# {"name": "SpanningTree", "size": 3416}
|
28
|
-
# ]
|
29
|
-
# },
|
30
|
-
# {
|
31
|
-
# "name": "optimization",
|
32
|
-
# "children": [
|
33
|
-
# {"name": "AspectRatioBanker", "size": 7074}
|
34
|
-
# ]
|
35
|
-
# }
|
36
|
-
# ]
|
37
|
-
# },
|
38
|
-
# {
|
39
|
-
# "name": "animate",
|
40
|
-
# "children": [
|
41
|
-
# {"name": "Easing", "size": 17010},
|
42
|
-
# {"name": "FunctionSequence", "size": 5842},
|
43
|
-
# {
|
44
|
-
# "name": "interpolate",
|
45
|
-
# "children": [
|
46
|
-
# {"name": "ArrayInterpolator", "size": 1983},
|
47
|
-
# {"name": "ColorInterpolator", "size": 2047},
|
48
|
-
# {"name": "DateInterpolator", "size": 1375},
|
49
|
-
# {"name": "Interpolator", "size": 8746},
|
50
|
-
# {"name": "MatrixInterpolator", "size": 2202},
|
51
|
-
# {"name": "NumberInterpolator", "size": 1382},
|
52
|
-
# {"name": "ObjectInterpolator", "size": 1629},
|
53
|
-
# {"name": "PointInterpolator", "size": 1675},
|
54
|
-
# {"name": "RectangleInterpolator", "size": 2042}
|
55
|
-
# ]
|
56
|
-
# },
|
57
|
-
# {"name": "ISchedulable", "size": 1041},
|
58
|
-
# {"name": "Parallel", "size": 5176},
|
59
|
-
# {"name": "Pause", "size": 449},
|
60
|
-
# {"name": "Scheduler", "size": 5593},
|
61
|
-
# {"name": "Sequence", "size": 5534},
|
62
|
-
# {"name": "Transition", "size": 9201},
|
63
|
-
# {"name": "Transitioner", "size": 19975},
|
64
|
-
# {"name": "TransitionEvent", "size": 1116},
|
65
|
-
# {"name": "Tween", "size": 6006}
|
66
|
-
# ]
|
67
|
-
# },
|
68
|
-
# {
|
69
|
-
# "name": "data",
|
70
|
-
# "children": [
|
71
|
-
# {
|
72
|
-
# "name": "converters",
|
73
|
-
# "children": [
|
74
|
-
# {"name": "Converters", "size": 721},
|
75
|
-
# {"name": "DelimitedTextConverter", "size": 4294},
|
76
|
-
# {"name": "GraphMLConverter", "size": 9800},
|
77
|
-
# {"name": "IDataConverter", "size": 1314},
|
78
|
-
# {"name": "JSONConverter", "size": 2220}
|
79
|
-
# ]
|
80
|
-
# },
|
81
|
-
# {"name": "DataField", "size": 1759},
|
82
|
-
# {"name": "DataSchema", "size": 2165},
|
83
|
-
# {"name": "DataSet", "size": 586},
|
84
|
-
# {"name": "DataSource", "size": 3331},
|
85
|
-
# {"name": "DataTable", "size": 772},
|
86
|
-
# {"name": "DataUtil", "size": 3322}
|
87
|
-
# ]
|
88
|
-
# },
|
89
|
-
# {
|
90
|
-
# "name": "display",
|
91
|
-
# "children": [
|
92
|
-
# {"name": "DirtySprite", "size": 8833},
|
93
|
-
# {"name": "LineSprite", "size": 1732},
|
94
|
-
# {"name": "RectSprite", "size": 3623},
|
95
|
-
# {"name": "TextSprite", "size": 10066}
|
96
|
-
# ]
|
97
|
-
# },
|
98
|
-
# {
|
99
|
-
# "name": "flex",
|
100
|
-
# "children": [
|
101
|
-
# {"name": "FlareVis1111", "size": 4116}
|
102
|
-
# ]
|
103
|
-
# },
|
104
|
-
# {
|
105
|
-
# "name": "physics",
|
106
|
-
# "children": [
|
107
|
-
# {"name": "DragForce", "size": 1082},
|
108
|
-
# {"name": "GravityForce", "size": 1336},
|
109
|
-
# {"name": "IForce", "size": 319},
|
110
|
-
# {"name": "NBodyForce", "size": 10498},
|
111
|
-
# {"name": "Particle", "size": 2822},
|
112
|
-
# {"name": "Simulation", "size": 9983},
|
113
|
-
# {"name": "Spring", "size": 2213},
|
114
|
-
# {"name": "SpringForce", "size": 1681}
|
115
|
-
# ]
|
116
|
-
# },
|
117
|
-
# {
|
118
|
-
# "name": "query",
|
119
|
-
# "children": [
|
120
|
-
# {"name": "AggregateExpression", "size": 1616},
|
121
|
-
# {"name": "And", "size": 1027},
|
122
|
-
# {"name": "Arithmetic", "size": 3891},
|
123
|
-
# {"name": "Average", "size": 891},
|
124
|
-
# {"name": "BinaryExpression", "size": 2893},
|
125
|
-
# {"name": "Comparison", "size": 5103},
|
126
|
-
# {"name": "CompositeExpression", "size": 3677},
|
127
|
-
# {"name": "Count", "size": 781},
|
128
|
-
# {"name": "DateUtil", "size": 4141},
|
129
|
-
# {"name": "Distinct", "size": 933},
|
130
|
-
# {"name": "Expression", "size": 5130},
|
131
|
-
# {"name": "ExpressionIterator", "size": 3617},
|
132
|
-
# {"name": "Fn", "size": 3240},
|
133
|
-
# {"name": "If", "size": 2732},
|
134
|
-
# {"name": "IsA", "size": 2039},
|
135
|
-
# {"name": "Literal", "size": 1214},
|
136
|
-
# {"name": "Match", "size": 3748},
|
137
|
-
# {"name": "Maximum", "size": 843},
|
138
|
-
# {
|
139
|
-
# "name": "methods",
|
140
|
-
# "children": [
|
141
|
-
# {"name": "add", "size": 593},
|
142
|
-
# {"name": "and", "size": 330},
|
143
|
-
# {"name": "average", "size": 287},
|
144
|
-
# {"name": "count", "size": 277},
|
145
|
-
# {"name": "distinct", "size": 292},
|
146
|
-
# {"name": "div", "size": 595},
|
147
|
-
# {"name": "eq", "size": 594},
|
148
|
-
# {"name": "fn", "size": 460},
|
149
|
-
# {"name": "gt", "size": 603},
|
150
|
-
# {"name": "gte", "size": 625},
|
151
|
-
# {"name": "iff", "size": 748},
|
152
|
-
# {"name": "isa", "size": 461},
|
153
|
-
# {"name": "lt", "size": 597},
|
154
|
-
# {"name": "lte", "size": 619},
|
155
|
-
# {"name": "max", "size": 283},
|
156
|
-
# {"name": "min", "size": 283},
|
157
|
-
# {"name": "mod", "size": 591},
|
158
|
-
# {"name": "mul", "size": 603},
|
159
|
-
# {"name": "neq", "size": 599},
|
160
|
-
# {"name": "not", "size": 386},
|
161
|
-
# {"name": "or", "size": 323},
|
162
|
-
# {"name": "orderby", "size": 307},
|
163
|
-
# {"name": "range", "size": 772},
|
164
|
-
# {"name": "select", "size": 296},
|
165
|
-
# {"name": "stddev", "size": 363},
|
166
|
-
# {"name": "sub", "size": 600},
|
167
|
-
# {"name": "sum", "size": 280},
|
168
|
-
# {"name": "update", "size": 307},
|
169
|
-
# {"name": "variance", "size": 335},
|
170
|
-
# {"name": "where", "size": 299},
|
171
|
-
# {"name": "xor", "size": 354},
|
172
|
-
# {"name": "_", "size": 264}
|
173
|
-
# ]
|
174
|
-
# },
|
175
|
-
# {"name": "Minimum", "size": 843},
|
176
|
-
# {"name": "Not", "size": 1554},
|
177
|
-
# {"name": "Or", "size": 970},
|
178
|
-
# {"name": "Query", "size": 13896},
|
179
|
-
# {"name": "Range", "size": 1594},
|
180
|
-
# {"name": "StringUtil", "size": 4130},
|
181
|
-
# {"name": "Sum", "size": 791},
|
182
|
-
# {"name": "Variable", "size": 1124},
|
183
|
-
# {"name": "Variance", "size": 1876},
|
184
|
-
# {"name": "Xor", "size": 1101}
|
185
|
-
# ]
|
186
|
-
# },
|
187
|
-
# {
|
188
|
-
# "name": "scale",
|
189
|
-
# "children": [
|
190
|
-
# {"name": "IScaleMap", "size": 2105},
|
191
|
-
# {"name": "LinearScale", "size": 1316},
|
192
|
-
# {"name": "LogScale", "size": 3151},
|
193
|
-
# {"name": "OrdinalScale", "size": 3770},
|
194
|
-
# {"name": "QuantileScale", "size": 2435},
|
195
|
-
# {"name": "QuantitativeScale", "size": 4839},
|
196
|
-
# {"name": "RootScale", "size": 1756},
|
197
|
-
# {"name": "Scale", "size": 4268},
|
198
|
-
# {"name": "ScaleType", "size": 1821},
|
199
|
-
# {"name": "TimeScale", "size": 5833}
|
200
|
-
# ]
|
201
|
-
# },
|
202
|
-
# {
|
203
|
-
# "name": "util",
|
204
|
-
# "children": [
|
205
|
-
# {"name": "Arrays", "size": 8258},
|
206
|
-
# {"name": "Colors", "size": 10001},
|
207
|
-
# {"name": "Dates", "size": 8217},
|
208
|
-
# {"name": "Displays", "size": 12555},
|
209
|
-
# {"name": "Filter", "size": 2324},
|
210
|
-
# {"name": "Geometry", "size": 10993},
|
211
|
-
# {
|
212
|
-
# "name": "heap",
|
213
|
-
# "children": [
|
214
|
-
# {"name": "FibonacciHeap", "size": 9354},
|
215
|
-
# {"name": "HeapNode", "size": 1233}
|
216
|
-
# ]
|
217
|
-
# },
|
218
|
-
# {"name": "IEvaluable", "size": 335},
|
219
|
-
# {"name": "IPredicate", "size": 383},
|
220
|
-
# {"name": "IValueProxy", "size": 874},
|
221
|
-
# {
|
222
|
-
# "name": "math",
|
223
|
-
# "children": [
|
224
|
-
# {"name": "DenseMatrix", "size": 3165},
|
225
|
-
# {"name": "IMatrix", "size": 2815},
|
226
|
-
# {"name": "SparseMatrix", "size": 3366}
|
227
|
-
# ]
|
228
|
-
# },
|
229
|
-
# {"name": "Maths", "size": 17705},
|
230
|
-
# {"name": "Orientation", "size": 1486},
|
231
|
-
# {
|
232
|
-
# "name": "palette",
|
233
|
-
# "children": [
|
234
|
-
# {"name": "ColorPalette", "size": 6367},
|
235
|
-
# {"name": "Palette", "size": 1229},
|
236
|
-
# {"name": "ShapePalette", "size": 2059},
|
237
|
-
# {"name": "SizePalette", "size": 2291}
|
238
|
-
# ]
|
239
|
-
# },
|
240
|
-
# {"name": "Property", "size": 5559},
|
241
|
-
# {"name": "Shapes", "size": 19118},
|
242
|
-
# {"name": "Sort", "size": 6887},
|
243
|
-
# {"name": "Stats", "size": 6557},
|
244
|
-
# {"name": "Strings", "size": 22026}
|
245
|
-
# ]
|
246
|
-
# },
|
247
|
-
# {
|
248
|
-
# "name": "vis",
|
249
|
-
# "children": [
|
250
|
-
# {
|
251
|
-
# "name": "axis",
|
252
|
-
# "children": [
|
253
|
-
# {"name": "Axes", "size": 1302},
|
254
|
-
# {"name": "Axis", "size": 24593},
|
255
|
-
# {"name": "AxisGridLine", "size": 652},
|
256
|
-
# {"name": "AxisLabel", "size": 636},
|
257
|
-
# {"name": "CartesianAxes", "size": 6703}
|
258
|
-
# ]
|
259
|
-
# },
|
260
|
-
# {
|
261
|
-
# "name": "controls",
|
262
|
-
# "children": [
|
263
|
-
# {"name": "AnchorControl", "size": 2138},
|
264
|
-
# {"name": "ClickControl", "size": 3824},
|
265
|
-
# {"name": "Control", "size": 1353},
|
266
|
-
# {"name": "ControlList", "size": 4665},
|
267
|
-
# {"name": "DragControl", "size": 2649},
|
268
|
-
# {"name": "ExpandControl", "size": 2832},
|
269
|
-
# {"name": "HoverControl", "size": 4896},
|
270
|
-
# {"name": "IControl", "size": 763},
|
271
|
-
# {"name": "PanZoomControl", "size": 5222},
|
272
|
-
# {"name": "SelectionControl", "size": 7862},
|
273
|
-
# {"name": "TooltipControl", "size": 8435}
|
274
|
-
# ]
|
275
|
-
# },
|
276
|
-
# {
|
277
|
-
# "name": "data",
|
278
|
-
# "children": [
|
279
|
-
# {"name": "Data", "size": 20544},
|
280
|
-
# {"name": "DataList", "size": 19788},
|
281
|
-
# {"name": "DataSprite", "size": 10349},
|
282
|
-
# {"name": "EdgeSprite", "size": 3301},
|
283
|
-
# {"name": "NodeSprite", "size": 19382},
|
284
|
-
# {
|
285
|
-
# "name": "render",
|
286
|
-
# "children": [
|
287
|
-
# {"name": "ArrowType", "size": 698},
|
288
|
-
# {"name": "EdgeRenderer", "size": 5569},
|
289
|
-
# {"name": "IRenderer", "size": 353},
|
290
|
-
# {"name": "ShapeRenderer", "size": 2247}
|
291
|
-
# ]
|
292
|
-
# },
|
293
|
-
# {"name": "ScaleBinding", "size": 11275},
|
294
|
-
# {"name": "Tree", "size": 7147},
|
295
|
-
# {"name": "TreeBuilder", "size": 9930}
|
296
|
-
# ]
|
297
|
-
# },
|
298
|
-
# {
|
299
|
-
# "name": "events",
|
300
|
-
# "children": [
|
301
|
-
# {"name": "DataEvent", "size": 2313},
|
302
|
-
# {"name": "SelectionEvent", "size": 1880},
|
303
|
-
# {"name": "TooltipEvent", "size": 1701},
|
304
|
-
# {"name": "VisualizationEvent", "size": 1117}
|
305
|
-
# ]
|
306
|
-
# },
|
307
|
-
# {
|
308
|
-
# "name": "legend",
|
309
|
-
# "children": [
|
310
|
-
# {"name": "Legend", "size": 20859},
|
311
|
-
# {"name": "LegendItem", "size": 4614},
|
312
|
-
# {"name": "LegendRange", "size": 10530}
|
313
|
-
# ]
|
314
|
-
# },
|
315
|
-
# {
|
316
|
-
# "name": "operator",
|
317
|
-
# "children": [
|
318
|
-
# {
|
319
|
-
# "name": "distortion",
|
320
|
-
# "children": [
|
321
|
-
# {"name": "BifocalDistortion", "size": 4461},
|
322
|
-
# {"name": "Distortion", "size": 6314},
|
323
|
-
# {"name": "FisheyeDistortion", "size": 3444}
|
324
|
-
# ]
|
325
|
-
# },
|
326
|
-
# {
|
327
|
-
# "name": "encoder",
|
328
|
-
# "children": [
|
329
|
-
# {"name": "ColorEncoder", "size": 3179},
|
330
|
-
# {"name": "Encoder", "size": 4060},
|
331
|
-
# {"name": "PropertyEncoder", "size": 4138},
|
332
|
-
# {"name": "ShapeEncoder", "size": 1690},
|
333
|
-
# {"name": "SizeEncoder", "size": 1830}
|
334
|
-
# ]
|
335
|
-
# },
|
336
|
-
# {
|
337
|
-
# "name": "filter",
|
338
|
-
# "children": [
|
339
|
-
# {"name": "FisheyeTreeFilter", "size": 5219},
|
340
|
-
# {"name": "GraphDistanceFilter", "size": 3165},
|
341
|
-
# {"name": "VisibilityFilter", "size": 3509}
|
342
|
-
# ]
|
343
|
-
# },
|
344
|
-
# {"name": "IOperator", "size": 1286},
|
345
|
-
# {
|
346
|
-
# "name": "label",
|
347
|
-
# "children": [
|
348
|
-
# {"name": "Labeler", "size": 9956},
|
349
|
-
# {"name": "RadialLabeler", "size": 3899},
|
350
|
-
# {"name": "StackedAreaLabeler", "size": 3202}
|
351
|
-
# ]
|
352
|
-
# },
|
353
|
-
# {
|
354
|
-
# "name": "layout",
|
355
|
-
# "children": [
|
356
|
-
# {"name": "AxisLayout", "size": 6725},
|
357
|
-
# {"name": "BundledEdgeRouter", "size": 3727},
|
358
|
-
# {"name": "CircleLayout", "size": 9317},
|
359
|
-
# {"name": "CirclePackingLayout", "size": 12003},
|
360
|
-
# {"name": "DendrogramLayout", "size": 4853},
|
361
|
-
# {"name": "ForceDirectedLayout", "size": 8411},
|
362
|
-
# {"name": "IcicleTreeLayout", "size": 4864},
|
363
|
-
# {"name": "IndentedTreeLayout", "size": 3174},
|
364
|
-
# {"name": "Layout", "size": 7881},
|
365
|
-
# {"name": "NodeLinkTreeLayout", "size": 12870},
|
366
|
-
# {"name": "PieLayout", "size": 2728},
|
367
|
-
# {"name": "RadialTreeLayout", "size": 12348},
|
368
|
-
# {"name": "RandomLayout", "size": 870},
|
369
|
-
# {"name": "StackedAreaLayout", "size": 9121},
|
370
|
-
# {"name": "TreeMapLayout", "size": 9191}
|
371
|
-
# ]
|
372
|
-
# },
|
373
|
-
# {"name": "Operator", "size": 2490},
|
374
|
-
# {"name": "OperatorList", "size": 5248},
|
375
|
-
# {"name": "OperatorSequence", "size": 4190},
|
376
|
-
# {"name": "OperatorSwitch", "size": 2581},
|
377
|
-
# {"name": "SortOperator", "size": 2023}
|
378
|
-
# ]
|
379
|
-
# },
|
380
|
-
# {"name": "Visualization", "size": 16540}
|
381
|
-
# ]
|
382
|
-
# }
|
383
|
-
# ]
|
384
|
-
#}
|
385
|
-
#
|
386
|
-
|
387
|
-
#
|
388
|
-
# Build hash with directory structure
|
389
|
-
#
|
390
|
-
class DirectoryToHash2Visitor < BasicTreeNodeVisitor
|
391
|
-
|
392
|
-
attr_reader :root
|
393
|
-
|
394
|
-
def initialize(pathname)
|
395
|
-
@stack = []
|
396
|
-
end
|
397
|
-
|
398
|
-
def enter_node(pathname)
|
399
|
-
@root = @node if @root.nil?
|
400
|
-
@node = { name: File.basename(pathname), children: [] }
|
401
|
-
@stack.last[:children] << @node unless @stack.empty?
|
402
|
-
@stack.push(@node)
|
403
|
-
end
|
404
|
-
|
405
|
-
def exit_node(pathname)
|
406
|
-
@node = @stack.pop
|
407
|
-
end
|
408
|
-
|
409
|
-
def visit_leaf(pathname)
|
410
|
-
begin
|
411
|
-
@node[:children] << { name: File.basename(pathname), size: File.stat(pathname).size }
|
412
|
-
rescue Errno::ENOENT => e
|
413
|
-
$stderr.puts e.to_s
|
414
|
-
end
|
415
|
-
end
|
416
|
-
|
417
|
-
end
|
418
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
dummy.txt
|
File without changes
|