ruby_motion_query 0.9.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78e17a1432f6e663df4fbde26aa5b7d065ab3e13
4
- data.tar.gz: a8aaddbde4902152465378ed69229d9acab88ccf
3
+ metadata.gz: 9e90368cbe7056ffc25cfe7f6a0ce0aaaf540248
4
+ data.tar.gz: 4808129ea2c00202d834e7e8f9ba7fadc22531c0
5
5
  SHA512:
6
- metadata.gz: 7a919b4152a20dae5566681fef722abc79ac12d04ecb8c1e7bea191b491d61c8daf642647f5d426c4938d0324e85895b92d225e92733530b8772ee7fccacfd96
7
- data.tar.gz: 2ca7cf6db4c949637aca82f39316374dc53d4aa45d52debe3cbedf983fc3ed133cbbe71a4f62a3f1520b997c8f0a4d2fe6204105af914d194d162c535332cac4
6
+ metadata.gz: 0f12f17778cf3e88812e9b9b63fe0d3e1c0eb1608077f854a03692d07011ce9342b3d211f6bf6ace12a269f55129c6a0e906c40976fd15308250880085dae460
7
+ data.tar.gz: 12b96cc830cb55e3ec93fd07fd37d231a68e48da919e312b74c278e747c09a0b798252a3330be01ca42f2582410f7622acd7ecab4cb5612abacdacc14c29a4ca
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  A fast, non-polluting, chaining, front-end library. It’s like jQuery for [RubyMotion](http://rubymotion.com) plus templates, stylesheets, events, animations, etc.
11
11
 
12
- One of RMQ's goal is to have the best [documentation][1] of any RubyMotion UI library.
12
+ One of RMQ's goals is to have the best [documentation][1] of any RubyMotion UI library.
13
13
 
14
14
  <br />
15
15
 
@@ -35,7 +35,7 @@ bundle
35
35
  rake
36
36
  ```
37
37
 
38
- rbenv rehash after gem install if you use rbenv
38
+ `rbenv rehash` after gem install if you use rbenv
39
39
 
40
40
  <br />
41
41
 
data/bin/rmq CHANGED
@@ -123,13 +123,13 @@ class RmqCommandLine
123
123
  @in_app_path = File.dirname(template_file_path_and_name).gsub(@template_path, '')
124
124
  @ext = File.extname(template_file_path_and_name)
125
125
  @file_name = File.basename(template_file_path_and_name, @ext)
126
-
126
+
127
127
  @new_file_name = @file_name.gsub('name', @name)
128
128
  @new_file_path_name = "#{Dir.pwd}/#{@in_app_path}/#{@new_file_name}#{@ext}"
129
129
 
130
130
  if @dry_run
131
131
  puts "\n Instance vars:"
132
- self.instance_variables.each{|var| puts " #{var} = #{self.instance_variable_get(var)}"}
132
+ self.instance_variables.each{|var| puts " #{var} = #{self.instance_variable_get(var)}"}
133
133
  puts
134
134
  end
135
135
 
@@ -21,8 +21,14 @@ module RubyMotionQuery
21
21
  end
22
22
  end
23
23
 
24
+ def windows
25
+ if shared_application = UIApplication.sharedApplication
26
+ shared_application.windows
27
+ end
28
+ end
29
+
24
30
  # @return [UIApplicationDelegate]
25
- def delegate
31
+ def delegate
26
32
  UIApplication.sharedApplication.delegate
27
33
  end
28
34
 
@@ -52,6 +58,11 @@ module RubyMotionQuery
52
58
  NSBundle.mainBundle.infoDictionary['CFBundleVersion']
53
59
  end
54
60
 
61
+ # @return [String] Short version
62
+ def short_version
63
+ NSBundle.mainBundle.infoDictionary['CFBundleShortVersionString']
64
+ end
65
+
55
66
  # @return [String] Name of app
56
67
  def name
57
68
  NSBundle.mainBundle.objectForInfoDictionaryKey 'CFBundleDisplayName'
@@ -92,6 +103,8 @@ module RubyMotionQuery
92
103
  current_view_controller(root_view_controller.topViewController)
93
104
  elsif root_view_controller.respond_to?(:frontViewController)
94
105
  current_view_controller(root_view_controller.frontViewController)
106
+ elsif root_view_controller.respond_to?(:center)
107
+ current_view_controller(root_view_controller.center)
95
108
  elsif root_view_controller.childViewControllers.count > 0
96
109
  current_view_controller(root_view_controller.childViewControllers.first)
97
110
  else
@@ -1,13 +1,37 @@
1
1
  module RubyMotionQuery
2
2
  class RMQ
3
- # @return [Color]
4
- def self.color
5
- Color
3
+ # @param color value options
4
+ # @return [UIColor]
5
+ # @example
6
+ # color('#ffffff')
7
+ # color('ffffff')
8
+ # color('#336699cc')
9
+ # color('369c')
10
+ # color(255,255,255,0.5)
11
+ # color(r: 255,g: 255,b: 255,a: 0.5)
12
+ # color(red: 255,green: 255,blue: 255,alpha: 0.5)
13
+ # color.from_hsva(h: 100,s: 140,b: 80,a: 1.0)
14
+ def self.color(*params)
15
+ if params.empty?
16
+ Color
17
+ else
18
+ ColorFactory.build(params)
19
+ end
6
20
  end
7
21
 
8
- # @return [Color]
9
- def color
10
- Color
22
+ # @param color value options
23
+ # @return [UIColor]
24
+ # @example
25
+ # color('#ffffff')
26
+ # color('ffffff')
27
+ # color('#336699cc')
28
+ # color('369c')
29
+ # color(255,255,255,0.5)
30
+ # color(r: 255,g: 255,b: 255,a: 0.5)
31
+ # color(red: 255,green: 255,blue: 255,alpha: 0.5)
32
+ # color.from_hsva(h: 100,s: 140,b: 80,a: 1.0)
33
+ def color(*params)
34
+ self.class.color(*params)
11
35
  end
12
36
  end
13
37
 
@@ -76,7 +100,7 @@ module RubyMotionQuery
76
100
  # my_label.color = rmq.color.foo # or just color.foo in a stylesheet
77
101
  def add_named(key, hex_or_color)
78
102
  color = if hex_or_color.is_a?(String)
79
- Color.from_hex(hex_or_color)
103
+ ColorFactory.from_hex(hex_or_color)
80
104
  else
81
105
  hex_or_color
82
106
  end
@@ -86,30 +110,17 @@ module RubyMotionQuery
86
110
  end
87
111
  end
88
112
 
89
- # Creates a color from a hex triplet
90
- #
91
- # Thanks bubblewrap for this method
113
+ # Creates a color from a hex triplet (rgb) or quartet (rgba)
92
114
  #
93
115
  # @param hex with or without the #
94
116
  # @return [UIColor]
95
117
  # @example
96
118
  # color.from_hex('#ffffff')
97
119
  # color.from_hex('ffffff')
98
- def from_hex(hex_color)
99
- hex_color = hex_color.gsub("#", "")
100
- case hex_color.size
101
- when 3
102
- colors = hex_color.scan(%r{[0-9A-Fa-f]}).map{ |el| (el * 2).to_i(16) }
103
- when 6
104
- colors = hex_color.scan(%r<[0-9A-Fa-f]{2}>).map{ |el| el.to_i(16) }
105
- else
106
- raise ArgumentError
107
- end
108
- if colors.size == 3
109
- from_rgba(colors[0], colors[1], colors[2], 1.0)
110
- else
111
- raise ArgumentError
112
- end
120
+ # color.from_hex('#336699cc')
121
+ # color.from_hex('369c')
122
+ def from_hex(str)
123
+ ColorFactory.from_hex(str)
113
124
  end
114
125
 
115
126
  # @return [UIColor]
@@ -117,7 +128,7 @@ module RubyMotionQuery
117
128
  # @example
118
129
  # rmq.color.from_rgba(255,255,255,0.5)
119
130
  def from_rgba(r,g,b,a)
120
- UIColor.colorWithRed((r/255.0), green: (g/255.0), blue: (b/255.0), alpha: a)
131
+ ColorFactory.from_rgba(r,g,b,a)
121
132
  end
122
133
 
123
134
  # @return [UIColor]
@@ -125,13 +136,102 @@ module RubyMotionQuery
125
136
  # @example
126
137
  # rmq.color.from_hsva(100,140,80,1.0)
127
138
  def from_hsva(h,s,v,a)
128
- UIColor.alloc.initWithHue(h, saturation: s, brightness: v, alpha: a)
139
+ ColorFactory.from_hsva(h,s,v,a)
129
140
  end
130
141
 
131
142
  def random
132
- from_rgba(rand(255), rand(255), rand(255), 1.0)
143
+ ColorFactory.from_rgba(rand(255), rand(255), rand(255), 1.0)
133
144
  end
134
145
  end
146
+ end
147
+
148
+ class ColorFactory
149
+ def self.build(params)
150
+ return Color if params.empty?
151
+ return from_rgba(*params) if params.count > 1
152
+
153
+ param = params.first
154
+ return from_hex(params.join) if param.is_a?(String)
155
+
156
+ return from_base_color(param) if base_values(param)
157
+ return try_rgba(param) if rgba_values(param)
158
+ return try_hsva(param) if hsva_values(param)
159
+ return try_hex(param) if hex_values(param)
160
+ end
161
+
162
+ def self.from_base_color(values)
163
+ base = values[:base] || values[:color]
164
+ r, g, b, a = Pointer.new('d'), Pointer.new('d'), Pointer.new('d'), Pointer.new('d')
165
+ base.getRed(r, green: g, blue: b, alpha: a)
166
+
167
+ r = values[:r] || values[:red] || r.value
168
+ g = values[:g] || values[:green] || g.value
169
+ b = values[:b] || values[:blue] || b.value
170
+ a = values[:a] || values[:alpha] || a.value
171
+
172
+ UIColor.colorWithRed(r, green: g, blue: b, alpha: a)
173
+ end
174
+
175
+ def self.try_rgba(values)
176
+ r = values[:red] || values[:r]
177
+ g = values[:green] || values[:g]
178
+ b = values[:blue] || values[:b]
179
+ a = values[:alpha] || values[:a] || 1.0
180
+ raise ArgumentError unless r && g && b && a
181
+
182
+ from_rgba(r, g, b, a)
183
+ end
184
+
185
+ def self.try_hsva(values)
186
+ h = values[:hue] || values[:h]
187
+ s = values[:saturation] || values[:s]
188
+ v = values[:brightness] || values[:b]
189
+ a = values[:alpha] || values[:a] || 1.0
190
+ raise ArgumentError unless h && s && s && v && a
191
+
192
+ Color.from_hsva(h, s, v, a)
193
+ end
194
+
195
+ def self.try_hex(values)
196
+ hex = values[:hex] || values[:x]
197
+ alpha = values[:alpha] || values[:a]
198
+
199
+ color = from_hex(hex)
200
+ color = color.colorWithAlphaComponent(alpha) if alpha
201
+ color
202
+ end
203
+
204
+ def self.rgba_values(values)
205
+ values[:red] || values[:r] || values[:green] || values[:g] || values[:blue]
206
+ end
207
+
208
+ def self.base_values(values)
209
+ values[:base] || values[:color]
210
+ end
135
211
 
212
+ def self.hsva_values(values)
213
+ values[:hue] || values[:h] || values[:saturation] || values[:s] || values[:brightness]
214
+ end
215
+
216
+ def self.hex_values(values)
217
+ values[:hex] || values[:x]
218
+ end
219
+
220
+ def self.from_rgba(r,g,b,a=1.0)
221
+ UIColor.colorWithRed((r/255.0), green: (g/255.0), blue: (b/255.0), alpha: a)
222
+ end
223
+
224
+ def self.from_hex(str)
225
+ r,g,b,a = case (str =~ /^#?(\h{3,8})$/ && $1.size)
226
+ when 3, 4 then $1.scan(/./ ).map {|c| (c*2).to_i(16) }
227
+ when 6, 8 then $1.scan(/../).map {|c| c.to_i(16) }
228
+ else raise ArgumentError
229
+ end
230
+ from_rgba(r, g, b, a ? (a/255.0) : 1.0)
231
+ end
232
+
233
+ def self.from_hsva(h,s,v,a)
234
+ UIColor.alloc.initWithHue(h, saturation: s, brightness: v, alpha: a)
235
+ end
136
236
  end
137
237
  end
@@ -14,8 +14,9 @@ module RubyMotionQuery
14
14
 
15
15
  # @return [Debug]
16
16
  def debug
17
- Debug
17
+ Debug.new(self)
18
18
  end
19
+
19
20
  end
20
21
 
21
22
  # Notes:
@@ -26,61 +27,69 @@ module RubyMotionQuery
26
27
  # /usr/bin/malloc_history 89032 0x9508da0
27
28
  # /usr/bin/malloc_history 47706 0x937e5c0 | grep "rb_scope__.+?__"
28
29
  class Debug
29
- class << self
30
+ def initialize(rmq_object)
31
+ @rmq_parent = rmq_object
32
+ end
30
33
 
31
- # Warning, this is very slow
32
- def log_detailed(label, params = {})
33
- return unless RMQ.app.development? || RMQ.app.test?
34
+ # @return [Debug]
35
+ def colorize
36
+ rmq(@rmq_parent.selected).style { |st| st.background_color = rmq.color.random}
37
+ self
38
+ end
34
39
 
35
- objects = params[:objects]
36
- skip_first_caller = params[:skip_first_caller]
40
+ # Warning, this is very slow
41
+ def log_detailed(label, params = {})
42
+ return unless RMQ.app.development? || RMQ.app.test?
37
43
 
38
- if block_given? && !objects
39
- objects = yield
40
- end
44
+ objects = params[:objects]
45
+ skip_first_caller = params[:skip_first_caller]
41
46
 
42
- callers = caller
43
- callers = callers.drop(1) if skip_first_caller
47
+ if block_given? && !objects
48
+ objects = yield
49
+ end
44
50
 
45
- out = %(
51
+ callers = caller
52
+ callers = callers.drop(1) if skip_first_caller
46
53
 
47
- ------------------------------------------------
48
- Deep log - #{label}
49
- At: #{Time.now.to_s}
54
+ out = %(
50
55
 
51
- Callers:
52
- #{callers.join("\n - ")}
56
+ ------------------------------------------------
57
+ Deep log - #{label}
58
+ At: #{Time.now.to_s}
53
59
 
54
- Objects:
55
- #{objects.map{|k, v| "#{k.to_s}: #{v.inspect}" }.join("\n\n")}
56
- ------------------------------------------------
60
+ Callers:
61
+ #{callers.join("\n - ")}
57
62
 
58
- ).gsub(/^ +/, '')
63
+ Objects:
64
+ #{objects.map{|k, v| "#{k.to_s}: #{v.inspect}" }.join("\n\n")}
65
+ ------------------------------------------------
59
66
 
60
- NSLog out
61
- label
62
- end
67
+ ).gsub(/^ +/, '')
68
+
69
+ NSLog out
70
+ label
71
+ end
63
72
 
64
- # Warning, this is very slow to output log, checking truthy however is
65
- # basically as performant as an if statement
66
- #
67
- # @example
68
- #
69
- # # foo and bar are objects we want to inspect
70
- # rmq.debug.assert(1==2, 'Bad stuff happened', {
71
- # foo: foo,
72
- # bar: bar
73
- # })
74
- def assert(truthy, label = nil, objects = nil)
75
- if (RMQ.app.development? || RMQ.app.test?) && !truthy
76
- label ||= 'Assert failed'
77
- if block_given? && !objects
78
- objects = yield
79
- end
80
- log_detailed label, objects: objects, skip_first_caller: true
73
+ # Warning, this is very slow to output log, checking truthy however is
74
+ # basically as performant as an if statement
75
+ #
76
+ # @example
77
+ #
78
+ # # foo and bar are objects we want to inspect
79
+ # rmq.debug.assert(1==2, 'Bad stuff happened', {
80
+ # foo: foo,
81
+ # bar: bar
82
+ # })
83
+ def self.assert(truthy, label = nil, objects = nil)
84
+ if (RMQ.app.development? || RMQ.app.test?) && !truthy
85
+ label ||= 'Assert failed'
86
+ if block_given? && !objects
87
+ objects = yield
81
88
  end
89
+ log_detailed label, objects: objects, skip_first_caller: true
82
90
  end
83
91
  end
92
+
84
93
  end
85
94
  end
86
95
 
@@ -26,6 +26,16 @@ module RubyMotionQuery
26
26
  UIDevice.currentDevice.systemVersion
27
27
  end
28
28
 
29
+ # Identify if current version is at least that of what is passed.
30
+ # Will not work if apple ever does semantic versions like 8.2.1
31
+ # `rmq.device.ios_at_least? 8`
32
+ # `rmq.device.ios_at_least? 7.1`
33
+ #
34
+ # @return [Boolean]
35
+ def ios_at_least? version
36
+ version.to_f.round(3) <= ios_version.to_f.round(3)
37
+ end
38
+
29
39
  # @return [UIScreen]
30
40
  def screen
31
41
  UIScreen.mainScreen
@@ -16,7 +16,7 @@ module RubyMotionQuery
16
16
 
17
17
  # rmq.format.number(1232, '#,##0.##')
18
18
  def numeric(number, format)
19
- RubyMotionQuery::Format.numeric_formatter(format).stringFromNumber(number)
19
+ RubyMotionQuery::Format::Numeric.formatter(format).stringFromNumber(number)
20
20
  end
21
21
  alias :number :numeric
22
22
 
@@ -24,30 +24,98 @@ module RubyMotionQuery
24
24
  #
25
25
  # See <http://www.unicode.org/reports/tr35/tr35-19.html#Date_Format_Patterns>
26
26
  # for more information about date format strings.
27
- def date(date, format)
28
- RubyMotionQuery::Format.date_formatter(format).stringFromDate(date)
27
+ def date(date, *format_or_styles)
28
+ RubyMotionQuery::Format::Date.formatter(*format_or_styles).stringFromDate(date)
29
29
  end
30
30
 
31
31
  def numeric_formatter(format)
32
+ RubyMotionQuery::Format::Numeric.formatter(format)
33
+ end
34
+
35
+ def date_formatter(*format_or_styles)
36
+ RubyMotionQuery::Format::Date.formatter(*format_or_styles)
37
+ end
38
+ end
39
+ end
40
+
41
+ class Format::Numeric
42
+ class << self
43
+
44
+ def formatter(format)
32
45
  @_numeric_formatter ||= {}
33
46
 
34
47
  # Caching here is very important for performance
35
48
  @_numeric_formatter[format] ||= begin
36
49
  number_formater = NSNumberFormatter.alloc.init
37
50
  number_formater.setPositiveFormat(format)
38
- number_formater
51
+ number_formater
52
+ end
53
+ end
54
+
55
+ end
56
+ end
57
+
58
+ class Format::Date
59
+
60
+ DATE_STYLES = {
61
+ short_date: NSDateFormatterShortStyle,
62
+ medium_date: NSDateFormatterMediumStyle,
63
+ long_date: NSDateFormatterLongStyle,
64
+ full_date: NSDateFormatterFullStyle
65
+ }
66
+
67
+ TIME_STYLES = {
68
+ short_time: NSDateFormatterShortStyle,
69
+ medium_time: NSDateFormatterMediumStyle,
70
+ long_time: NSDateFormatterLongStyle,
71
+ full_time: NSDateFormatterFullStyle
72
+ }
73
+
74
+ class << self
75
+
76
+ def formatter(*format_or_styles)
77
+ raise(ArgumentError, "formatter requires at least one parameter") if format_or_styles.first.nil?
78
+
79
+ if format_or_styles.first.is_a?(String)
80
+ formatter_from_format(format_or_styles.first)
81
+ else
82
+ formatter_from_styles(*format_or_styles)
39
83
  end
40
84
  end
41
85
 
42
- def date_formatter(format)
86
+ def formatter_from_format(format)
43
87
  @_date_formatters ||= {}
44
88
 
45
89
  # Caching here is very important for performance
46
90
  @_date_formatters[format] ||= begin
47
- format_template = NSDateFormatter.dateFormatFromTemplate(format, options:0,
48
- locale: NSLocale.currentLocale)
49
91
  date_formatter = NSDateFormatter.alloc.init
92
+
93
+ format_template = NSDateFormatter.dateFormatFromTemplate(
94
+ format,
95
+ options:0,
96
+ locale: NSLocale.currentLocale
97
+ )
50
98
  date_formatter.setDateFormat(format_template)
99
+
100
+ date_formatter
101
+ end
102
+ end
103
+
104
+ def formatter_from_styles(*styles)
105
+ @_date_formatters ||= {}
106
+
107
+ # Caching here is very important for performance
108
+ @_date_formatters[styles.to_s] ||= begin
109
+ date_formatter = NSDateFormatter.alloc.init
110
+
111
+ styles.each do |style|
112
+ if DATE_STYLES.has_key?(style)
113
+ date_formatter.setDateStyle(DATE_STYLES.fetch(style))
114
+ elsif TIME_STYLES.has_key?(style)
115
+ date_formatter.setTimeStyle(TIME_STYLES.fetch(style))
116
+ end
117
+ end
118
+
51
119
  date_formatter
52
120
  end
53
121
  end
@@ -1,6 +1,8 @@
1
1
  module RubyMotionQuery
2
2
 
3
3
  class RMQ
4
+ RECT_WHITELIST = [:grid, :g, :l, :left, :x, :fl, :top, :t, :y, :w, :width, :h, :height, :below_prev, :bp, :below_previous, :left_of_prev, :lop, :left_of_previous, :r, :right, :b, :bottom, :from_right, :fr, :from_bottom, :fb, :centered, :padding, :p, :above_prev, :ap, :above_previous, :rop, :right_of_prev, :right_of_previous, :left_of_prev, :lop, :left_of_previous]
5
+
4
6
  # @return RubyMotionQuery::Rect or array of RubyMotionQuery::Rect
5
7
  #
6
8
  # @example
@@ -179,6 +181,12 @@ module RubyMotionQuery
179
181
  not_in_root_view = !(vc.view == sv)
180
182
  end
181
183
 
184
+ # performant warn if hash has keys that are not whitelisted
185
+ unknown_keys = params.keys - RMQ::RECT_WHITELIST
186
+ unless unknown_keys.empty?
187
+ puts "\n[RMQ ERROR] rect keys #{unknown_keys} don't exist. Verify your hash for #{view.class.name} uses approved keys - #{RMQ::RECT_WHITELIST}\n\n"
188
+ end
189
+
182
190
  # Grid
183
191
  if grid
184
192
  if params_g = params[:grid] || params[:g]
@@ -190,7 +198,7 @@ module RubyMotionQuery
190
198
  end
191
199
  end
192
200
 
193
- params_l = params[:l] || params[:left] || params[:x]
201
+ params_l = params[:l] || params[:left] || params[:x] || params[:fl]
194
202
  params_t = params[:t] || params[:top] || params[:y]
195
203
  params_w = params[:w] || params[:width]
196
204
  params_h = params[:h] || params[:height]
@@ -244,6 +252,18 @@ module RubyMotionQuery
244
252
  l = prev_view.frame.origin.x - left_of_prev - w
245
253
  end
246
254
  end
255
+ else
256
+ if below_prev
257
+ t = below_prev
258
+ elsif above_prev
259
+ t = above_prev - h
260
+ end
261
+
262
+ if right_of_prev
263
+ l = right_of_prev
264
+ elsif left_of_prev
265
+ l = left_of_prev - w
266
+ end
247
267
  end
248
268
 
249
269
  if sv
@@ -189,16 +189,14 @@ module RubyMotionQuery
189
189
 
190
190
  # Convenience methods -------------------
191
191
  def rmq(*working_selectors)
192
- q = if @controller.nil?
193
- RubyMotionQuery::RMQ.new
194
- else
195
- @controller.rmq
196
- end
197
-
198
- if working_selectors.length > 0
199
- q.wrap(working_selectors)
192
+ if @controller.nil?
193
+ if (app = RubyMotionQuery::RMQ.app) && (window = app.window) && (cvc = app.current_view_controller)
194
+ cvc.rmq(working_selectors)
195
+ else
196
+ RubyMotionQuery::RMQ.create_with_array_and_selectors([], working_selectors, self)
197
+ end
200
198
  else
201
- q
199
+ RubyMotionQuery::RMQ.create_with_selectors(working_selectors, @controller)
202
200
  end
203
201
  end
204
202
 
@@ -284,8 +282,8 @@ module RubyMotionQuery
284
282
  RMQ.image
285
283
  end
286
284
 
287
- def color
288
- RMQ.color
285
+ def color(*params)
286
+ RMQ.color(*params)
289
287
  end
290
288
 
291
289
  def font
@@ -1,5 +1,5 @@
1
1
  module RubyMotionQuery
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
 
4
4
  class RMQ
5
5
  def version
@@ -1,7 +1,5 @@
1
1
  class <%= @name_camel_case %>ControllerStylesheet < ApplicationStylesheet
2
2
 
3
- include <%= @name_camel_case %>CellStylesheet
4
-
5
3
  def setup
6
4
  # Add stylesheet specific setup stuff here.
7
5
  # Add application specific setup stuff in application_stylesheet.rb
@@ -10,4 +8,17 @@ class <%= @name_camel_case %>ControllerStylesheet < ApplicationStylesheet
10
8
  def table(st)
11
9
  st.background_color = color.gray
12
10
  end
11
+
12
+ def <%= @name %>_cell_height
13
+ 80
14
+ end
15
+
16
+ def <%= @name %>_cell(st)
17
+ # Style overall cell here
18
+ st.background_color = color.random
19
+ end
20
+
21
+ def cell_label(st)
22
+ st.color = color.black
23
+ end
13
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_motion_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Werth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-17 00:00:00.000000000 Z
12
+ date: 2014-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon
@@ -106,11 +106,11 @@ files:
106
106
  - templates/collection_view_controller/app/stylesheets/name_cell_stylesheet.rb
107
107
  - templates/collection_view_controller/app/stylesheets/name_controller_stylesheet.rb
108
108
  - templates/collection_view_controller/app/views/name_cell.rb
109
- - templates/collection_view_controller/spec/controllers/name_controller.rb
109
+ - templates/collection_view_controller/spec/controllers/name_controller_spec.rb
110
110
  - templates/collection_view_controller/spec/views/name_cell.rb
111
111
  - templates/controller/app/controllers/name_controller.rb
112
112
  - templates/controller/app/stylesheets/name_controller_stylesheet.rb
113
- - templates/controller/spec/controllers/name_controller.rb
113
+ - templates/controller/spec/controllers/name_controller_spec.rb
114
114
  - templates/lib/lib/name.rb
115
115
  - templates/lib/spec/lib/name.rb
116
116
  - templates/model/app/models/name.rb
@@ -118,10 +118,9 @@ files:
118
118
  - templates/shared/app/shared/name.rb
119
119
  - templates/shared/spec/shared/name.rb
120
120
  - templates/table_view_controller/app/controllers/name_controller.rb
121
- - templates/table_view_controller/app/stylesheets/name_cell_stylesheet.rb
122
121
  - templates/table_view_controller/app/stylesheets/name_controller_stylesheet.rb
123
122
  - templates/table_view_controller/app/views/name_cell.rb
124
- - templates/table_view_controller/spec/controllers/name_controller.rb
123
+ - templates/table_view_controller/spec/controllers/name_controller_spec.rb
125
124
  - templates/table_view_controller/spec/views/name_cell.rb
126
125
  - templates/view/app/stylesheets/name_stylesheet.rb
127
126
  - templates/view/app/views/name.rb
@@ -1,14 +0,0 @@
1
- module <%= @name_camel_case %>CellStylesheet
2
- def <%= @name %>_cell_height
3
- 80
4
- end
5
-
6
- def <%= @name %>_cell(st)
7
- # Style overall cell here
8
- st.background_color = color.random
9
- end
10
-
11
- def cell_label(st)
12
- st.color = color.black
13
- end
14
- end