teacup 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/teacup/layout.rb +17 -11
- data/lib/teacup/version.rb +1 -1
- metadata +17 -7
data/lib/teacup/layout.rb
CHANGED
@@ -59,7 +59,9 @@ module Teacup
|
|
59
59
|
# subview(UIImage, backgroundColor: UIColor.colorWithImagePattern(image)
|
60
60
|
# end
|
61
61
|
#
|
62
|
-
def layout(
|
62
|
+
def layout(view_or_class, name_or_properties=nil, properties_or_nil=nil, &block)
|
63
|
+
view = to_instance(view_or_class)
|
64
|
+
|
63
65
|
name = nil
|
64
66
|
properties = properties_or_nil
|
65
67
|
|
@@ -123,16 +125,7 @@ module Teacup
|
|
123
125
|
# end
|
124
126
|
#
|
125
127
|
def subview(class_or_instance, *args, &block)
|
126
|
-
|
127
|
-
unless class_or_instance <= UIView
|
128
|
-
raise "Expected subclass of UIView, got: #{class_or_instance.inspect}"
|
129
|
-
end
|
130
|
-
instance = class_or_instance.new
|
131
|
-
elsif UIView === class_or_instance
|
132
|
-
instance = class_or_instance
|
133
|
-
else
|
134
|
-
raise "Expected a UIView, got: #{class_or_instance.inspect}"
|
135
|
-
end
|
128
|
+
instance = to_instance(class_or_instance)
|
136
129
|
|
137
130
|
(superview_chain.last || top_level_view).addSubview(instance)
|
138
131
|
|
@@ -143,6 +136,19 @@ module Teacup
|
|
143
136
|
|
144
137
|
protected
|
145
138
|
|
139
|
+
def to_instance(class_or_instance)
|
140
|
+
if Class === class_or_instance
|
141
|
+
unless class_or_instance <= UIView
|
142
|
+
raise "Expected subclass of UIView, got: #{class_or_instance.inspect}"
|
143
|
+
end
|
144
|
+
return class_or_instance.new
|
145
|
+
elsif class_or_instance.is_a?(UIView)
|
146
|
+
return class_or_instance
|
147
|
+
else
|
148
|
+
raise "Expected a UIView, got: #{class_or_instance.inspect}"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
146
152
|
# Get's the current stack of views in nested calls to layout.
|
147
153
|
#
|
148
154
|
# The view at the end of the stack is the one into which subviews
|
data/lib/teacup/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teacup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
description: ! 'Teacup is a community-driven DSL for making CSS-like styling, and
|
37
47
|
layouts for
|
38
48
|
|
@@ -111,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
121
|
version: '0'
|
112
122
|
requirements: []
|
113
123
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.8.
|
124
|
+
rubygems_version: 1.8.19
|
115
125
|
signing_key:
|
116
126
|
specification_version: 3
|
117
127
|
summary: A community-driven DSL for creating user interfaces on iOS.
|