sugarcube 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sugarcube/adjust.rb +20 -8
- data/lib/sugarcube/version.rb +1 -1
- metadata +1 -1
data/lib/sugarcube/adjust.rb
CHANGED
@@ -169,31 +169,43 @@ module SugarCube
|
|
169
169
|
def tree(view=nil, tab=nil, is_last=true, views_index=nil)
|
170
170
|
unless view
|
171
171
|
@@sugarcube_view ||= nil
|
172
|
-
|
173
|
-
|
172
|
+
if @@sugarcube_view
|
173
|
+
view = @@sugarcube_view
|
174
|
+
else
|
175
|
+
view = UIApplication.sharedApplication.keyWindow
|
176
|
+
end
|
174
177
|
end
|
175
178
|
|
176
179
|
if not views_index
|
177
180
|
is_first = true
|
178
|
-
@@sugarcube_views = []
|
181
|
+
@@sugarcube_views = [view]
|
179
182
|
views_index = 0
|
180
183
|
else
|
181
184
|
is_first = false
|
185
|
+
@@sugarcube_views << view
|
182
186
|
end
|
183
187
|
|
184
|
-
|
185
|
-
|
188
|
+
space = ' '
|
189
|
+
if views_index < 10
|
190
|
+
print " "
|
191
|
+
elsif views_index < 100
|
192
|
+
print " "
|
193
|
+
elsif views_index > 999
|
194
|
+
# good god, man!
|
195
|
+
space = ''
|
196
|
+
end
|
197
|
+
print views_index.to_s + ":" + space
|
186
198
|
|
187
199
|
if tab
|
188
200
|
print tab
|
189
|
-
print is_last ? "`--
|
201
|
+
print is_last ? "`--" : "+--"
|
202
|
+
tab += is_last ? " " : "| "
|
190
203
|
else
|
191
|
-
print ".
|
204
|
+
print "."
|
192
205
|
tab = ""
|
193
206
|
end
|
194
207
|
puts view.inspect
|
195
208
|
|
196
|
-
tab += is_last ? " " : "| "
|
197
209
|
view.subviews.each_index {|index|
|
198
210
|
subview = view.subviews[index]
|
199
211
|
views_index += 1
|
data/lib/sugarcube/version.rb
CHANGED