sugarcube 0.3.2 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,13 @@ module SugarCube
6
6
  @@sugarcube_view ||= nil
7
7
  return @@sugarcube_view if not view
8
8
 
9
+ if view.is_a? Fixnum
10
+ @@sugarcube_views ||= nil
11
+ raise "no views have been assigned to SugarCube::Adjust::tree" unless @@sugarcube_views
12
+
13
+ view = @@sugarcube_views[view]
14
+ end
15
+
9
16
  @@sugarcube_view = view
10
17
  @@sugarcube_restore = {
11
18
  frame: SugarCube::Adjust.frame,
@@ -158,6 +165,44 @@ module SugarCube
158
165
  end
159
166
  alias :h :shadow
160
167
 
168
+ ##| TREE
169
+ def tree(view=nil, tab=nil, is_last=true, views_index=nil)
170
+ unless view
171
+ @@sugarcube_view ||= nil
172
+ raise "no view has been assigned to SugarCube::Adjust::adjust" unless @@sugarcube_view
173
+ view = @@sugarcube_view
174
+ end
175
+
176
+ if not views_index
177
+ is_first = true
178
+ @@sugarcube_views = []
179
+ views_index = 0
180
+ else
181
+ is_first = false
182
+ end
183
+
184
+ print views_index.to_s + ': '
185
+ @@sugarcube_views << view
186
+
187
+ if tab
188
+ print tab
189
+ print is_last ? "`-- " : "+-- "
190
+ else
191
+ print ". "
192
+ tab = ""
193
+ end
194
+ puts view.inspect
195
+
196
+ tab += is_last ? " " : "| "
197
+ view.subviews.each_index {|index|
198
+ subview = view.subviews[index]
199
+ views_index += 1
200
+ views_index = tree(subview, tab, index == view.subviews.length - 1, views_index)
201
+ }
202
+
203
+ return is_first ? view : views_index
204
+ end
205
+
161
206
  ##| RESTORE
162
207
  def restore
163
208
  @@sugarcube_view ||= nil
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.3.2'
2
+ Version = '0.4'
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.3.2
4
+ version: '0.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-24 00:00:00.000000000 Z
13
+ date: 2012-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
- requirement: &70138590503260 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70138590503260
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rspec
28
- requirement: &70138590518760 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,7 +38,12 @@ dependencies:
33
38
  version: '0'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *70138590518760
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  description: ! 'CocoaTouch/iOS is a *verbose* framework. These extensions hope to
38
48
  make
39
49
 
@@ -106,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
116
  version: '0'
107
117
  requirements: []
108
118
  rubyforge_project:
109
- rubygems_version: 1.8.11
119
+ rubygems_version: 1.8.19
110
120
  signing_key:
111
121
  specification_version: 3
112
122
  summary: Extensions for Ruby to make Rubymotion development more enjoyable, and hopefully