teacup 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teacup (1.0.1)
4
+ teacup (1.0.3)
5
5
  rake
6
6
 
7
7
  GEM
data/Rakefile CHANGED
@@ -9,5 +9,4 @@ Motion::Project::App.setup do |app|
9
9
  app.name = 'teacup'
10
10
  app.identifier = 'com.rubymotion.teacup'
11
11
  app.vendor_project 'vendor/TeacupDummy', :static
12
- app.detect_dependencies = false
13
12
  end
@@ -0,0 +1,19 @@
1
+ module Teacup
2
+ module_function
3
+ def calculate(view, dimension, percent)
4
+ if percent.is_a? Proc
5
+ view.instance_exec(&percent)
6
+ elsif percent.is_a? String and percent[-1] == '%'
7
+ percent = percent[0...-1].to_f / 100.0
8
+
9
+ case dimension
10
+ when :width
11
+ CGRectGetWidth(view.superview.bounds) * percent
12
+ when :height
13
+ CGRectGetHeight(view.superview.bounds) * percent
14
+ end
15
+ else
16
+ percent
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Teacup
2
2
 
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
 
5
5
  end
@@ -87,7 +87,7 @@ class UIView
87
87
  when Symbol, String
88
88
  container = self
89
89
  constraint.target = nil
90
- while container.superview && constraint.target == nil
90
+ while container && constraint.target.nil?
91
91
  constraint.target = container.viewWithStylename(original_constraint.target)
92
92
  container = container.superview
93
93
  end
@@ -105,7 +105,7 @@ class UIView
105
105
  # superview, it checks all the leaves again.
106
106
  container = self
107
107
  constraint.relative_to = nil
108
- while container.superview && constraint.relative_to == nil
108
+ while container && constraint.relative_to.nil?
109
109
  constraint.relative_to = container.viewWithStylename(original_constraint.relative_to)
110
110
  container = container.superview
111
111
  end
@@ -1,23 +1,3 @@
1
- module Teacup
2
- module_function
3
- def calculate(view, dimension, percent)
4
- if percent.is_a? Proc
5
- view.instance_exec(&percent)
6
- elsif percent.is_a? String and percent[-1] == '%'
7
- percent = percent[0...-1].to_f / 100.0
8
-
9
- case dimension
10
- when :width
11
- CGRectGetWidth(view.superview.bounds) * percent
12
- when :height
13
- CGRectGetHeight(view.superview.bounds) * percent
14
- end
15
- else
16
- percent
17
- end
18
- end
19
- end
20
-
21
1
  ##|
22
2
  ##| UIView.frame
23
3
  ##|
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: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-30 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -74,6 +74,7 @@ files:
74
74
  - app/views/custom_view.rb
75
75
  - lib/dummy.rb
76
76
  - lib/teacup.rb
77
+ - lib/teacup/calculations.rb
77
78
  - lib/teacup/constraint.rb
78
79
  - lib/teacup/handler.rb
79
80
  - lib/teacup/layout.rb