sugarcube 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- raise "no view has been assigned to SugarCube::Adjust::adjust" unless @@sugarcube_view
173
- view = @@sugarcube_view
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
- print views_index.to_s + ': '
185
- @@sugarcube_views << view
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
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.4'
2
+ Version = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: