motion-loco 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c98e3096247b7eae3292a67a95d2b51a05683124
4
- data.tar.gz: 808638ee1a7b95c5dd44b6758afaade0394526f2
3
+ metadata.gz: be786608ca687bfacb8732b95724bdd70a4144c8
4
+ data.tar.gz: e64bf30c3cf9a785335f8790e5a077488adcc79f
5
5
  SHA512:
6
- metadata.gz: e3c2603821b5329287281c3f9ea3aeaace0fe69195bddc2bf4122c42db9a37d7ea61aa0993d9eaa658c6ab38ba0201d40ab1b11b9848b6fe4190683faada48e7
7
- data.tar.gz: 682dd22c9ec387eacb23d69b9129304e707a00b501d26bf02f9888d42f38325e237aa17090711f0a4470bea3004f02722b86957676a7bacf7adec3fa25afd7d7
6
+ metadata.gz: 01a24f5e39072fad6e5c2d42c9f5af640418af29c2922695bca657cc8d38fd5532082f4d20adc1c065335d1babfd55d0493c825dc0d0525821f94a9142d8fab0
7
+ data.tar.gz: 8da3ec624e6e72a3b99168c4ac4a53f8a4eda39e1c4012d32eafb1cb32cc3fc9be441b997674df2677760e5a94bccecb7301a728f3967e4d701bdb35c77ea096
data/README.md CHANGED
@@ -6,15 +6,9 @@ computed properties, and observers. **And Ember-Data inspired [data](#locofixtur
6
6
 
7
7
  ## What's New!
8
8
 
9
- ### June 23th, 2013
9
+ ### September 19th, 2013
10
10
 
11
- #### SQLiteAdapter and Relationships!
12
-
13
- I need to write up some better documentation, but be sure to check out the [Loco::SQLiteAdapter](#locosqliteadapter) and the new `has_many` and `belongs_to` relationships in `Loco::Model`.
14
-
15
- The relationship stuff needs some major code clean up, so don't copy my code if you're doing anything similar for loading/saving relationship data. :)
16
-
17
- The [tests](https://github.com/brianpattison/motion-loco/tree/master/spec) all pass though... so that's something, right?
11
+ Motion-Loco is being actively developed again after a few months of nothing, so yay!
18
12
 
19
13
  ## Installation
20
14
 
@@ -19,11 +19,7 @@ module Loco
19
19
  end
20
20
 
21
21
  def self.method_missing(method, *args, &block)
22
- if self.instance.respond_to? method
23
- self.instance.send(method, *args)
24
- else
25
- super
26
- end
22
+ self.instance.send(method, *args, &block)
27
23
  end
28
24
  end
29
25
 
@@ -20,14 +20,6 @@ module Loco
20
20
  self
21
21
  end
22
22
 
23
- # Used to create observable views.
24
- def initWithFrame(frame)
25
- super
26
- initialize_bindings
27
- set_properties({})
28
- self
29
- end
30
-
31
23
  # Used to create observable table view cells
32
24
  def initWithStyle(style, reuseIdentifier:reuseIdentifier)
33
25
  super
@@ -1,9 +1,14 @@
1
1
  module Loco
2
2
 
3
3
  module Resizable
4
- attr_accessor :parent_view
5
- alias_method :parentView, :parent_view
6
- alias_method :parentView=, :parent_view=
4
+ include Observable
5
+ attr_accessor :parent_view, :parentView
6
+
7
+ # Required for bindings to work for both styles
8
+ def parent_view=(view)
9
+ self.parentView = view
10
+ super
11
+ end
7
12
 
8
13
  # The position of the bottom edge,
9
14
  # relative to the superview's bottom edge.
@@ -11,8 +16,8 @@ module Loco
11
16
  attr_accessor :bottom
12
17
  def bottom
13
18
  if @bottom.is_a?(String)
14
- if self.parentView
15
- self.parentView.bounds.size.height * (@bottom.gsub('%', '').to_f / 100.0)
19
+ if self.parent_view
20
+ self.parent_view.bounds.size.height * (@bottom.gsub('%', '').to_f / 100.0)
16
21
  else
17
22
  0
18
23
  end
@@ -30,7 +35,7 @@ module Loco
30
35
  attr_accessor :height
31
36
  def height
32
37
  if @height.is_a?(String)
33
- self.parentView ? self.parentView.bounds.size.height * (@height.gsub('%', '').to_f / 100.0) : 0
38
+ self.parent_view ? self.parent_view.bounds.size.height * (@height.gsub('%', '').to_f / 100.0) : 0
34
39
  else
35
40
  @height
36
41
  end
@@ -46,7 +51,7 @@ module Loco
46
51
  attr_accessor :left
47
52
  def left
48
53
  if @left.is_a?(String)
49
- self.parentView ? self.parentView.bounds.size.width * (@left.gsub('%', '').to_f / 100.0) : 0
54
+ self.parent_view ? self.parent_view.bounds.size.width * (@left.gsub('%', '').to_f / 100.0) : 0
50
55
  else
51
56
  @left
52
57
  end
@@ -62,7 +67,7 @@ module Loco
62
67
  attr_accessor :right
63
68
  def right
64
69
  if @right.is_a?(String)
65
- self.parentView ? self.parentView.bounds.size.width * (@right.gsub('%', '').to_f / 100.0) : 0
70
+ self.parent_view ? self.parent_view.bounds.size.width * (@right.gsub('%', '').to_f / 100.0) : 0
66
71
  else
67
72
  @right
68
73
  end
@@ -78,7 +83,7 @@ module Loco
78
83
  attr_accessor :top
79
84
  def top
80
85
  if @top.is_a?(String)
81
- self.parentView ? self.parentView.bounds.size.height * (@top.gsub('%', '').to_f / 100.0) : 0
86
+ self.parent_view ? self.parent_view.bounds.size.height * (@top.gsub('%', '').to_f / 100.0) : 0
82
87
  else
83
88
  @top
84
89
  end
@@ -93,7 +98,7 @@ module Loco
93
98
  attr_accessor :width
94
99
  def width
95
100
  if @width.is_a?(String)
96
- self.parentView ? self.parentView.bounds.size.width * (@width.gsub('%', '').to_f / 100.0) : 0
101
+ self.parent_view ? self.parent_view.bounds.size.width * (@width.gsub('%', '').to_f / 100.0) : 0
97
102
  else
98
103
  @width
99
104
  end
@@ -105,17 +110,17 @@ module Loco
105
110
 
106
111
  # Create new instance from a hash of properties with values.
107
112
  # @param [Object] frame The CGRect or a Hash of properties.
108
- def initWithFrame(frame)
109
- if frame.is_a? Hash
113
+ def initWithFrame(properties={})
114
+ if properties.is_a? Hash
110
115
  # Set the initial property values from the given hash
111
116
  super(CGRect.new)
112
- frame.each do |key, value|
113
- self.send("#{key}=", value)
114
- end
117
+ initialize_bindings
118
+ set_properties(properties)
115
119
  else
116
- super(frame)
120
+ super(properties)
117
121
  end
118
122
  view_setup
123
+
119
124
  self
120
125
  end
121
126
 
@@ -293,10 +298,14 @@ module Loco
293
298
 
294
299
  # Fires when the superview changes.
295
300
  def willMoveToSuperview(superview)
296
- self.parentView = superview
301
+ self.parent_view = superview
297
302
  refresh_layout(superview)
298
303
  end
299
304
 
305
+ def self.included(base)
306
+ base.extend(Observable::ClassMethods)
307
+ end
308
+
300
309
  end
301
310
 
302
311
  end
@@ -1,3 +1,3 @@
1
1
  module Loco
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -7,22 +7,18 @@ module Loco
7
7
 
8
8
  class Button < UIButton
9
9
  include Resizable
10
- include Observable
11
10
  end
12
11
 
13
12
  class DatePicker < UIDatePicker
14
13
  include Resizable
15
- include Observable
16
14
  end
17
15
 
18
16
  class ImageView < UIImageView
19
17
  include Resizable
20
- include Observable
21
18
  end
22
19
 
23
20
  class Label < UILabel
24
21
  include Resizable
25
- include Observable
26
22
 
27
23
  def text_align
28
24
  case self.textAlignment
@@ -67,42 +63,34 @@ module Loco
67
63
 
68
64
  class PageControl < UIPageControl
69
65
  include Resizable
70
- include Observable
71
66
  end
72
67
 
73
68
  class PickerView < UIPickerView
74
69
  include Resizable
75
- include Observable
76
70
  end
77
71
 
78
72
  class ProgressView < UIProgressView
79
73
  include Resizable
80
- include Observable
81
74
  end
82
75
 
83
76
  class ScrollView < UIScrollView
84
77
  include Resizable
85
- include Observable
86
78
  end
87
79
 
88
80
  class Slider < UISlider
89
81
  include Resizable
90
- include Observable
91
82
  end
92
83
 
93
84
  class TextView < UITextView
94
85
  include Resizable
95
- include Observable
96
86
  end
97
87
 
98
88
  class Toolbar < UIToolbar
99
89
  include Resizable
100
- include Observable
101
90
  end
102
91
 
103
92
  class View < UIView
104
93
  include Resizable
105
- include Observable
106
94
 
107
95
  def border_radius
108
96
  self.layer.cornerRadius
@@ -117,7 +105,6 @@ module Loco
117
105
 
118
106
  class WebView < UIWebView
119
107
  include Resizable
120
- include Observable
121
108
  end
122
109
 
123
110
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-loco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-17 00:00:00.000000000 Z
11
+ date: 2013-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print_motion