motion-pixate-layout 0.0.5 → 0.0.6

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-pixate-layout (0.0.4)
4
+ motion-pixate-layout (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -64,8 +64,10 @@ module MotionPixateLayout
64
64
  subview.styleId = selector.style_id
65
65
  subview.styleClass = selector.style_classes.join(" ")
66
66
 
67
- attributes.each do |key, value|
68
- subview.send "#{key}=", value
67
+ unless attributes.nil?
68
+ attributes.each do |key, value|
69
+ subview.send "#{key}=", value
70
+ end
69
71
  end
70
72
 
71
73
  view.addSubview subview
@@ -78,11 +80,21 @@ module MotionPixateLayout
78
80
  end
79
81
  end
80
82
 
83
+ def self.add_subview_method(klass)
84
+ define_method klass.name do |*args, &block|
85
+ selector, options, = *args
86
+ subview klass, selector, options, &block
87
+ end
88
+ end
89
+
90
+
81
91
  def method_missing(method_name, *args, &block)
82
92
  if Kernel.constants.include?(method_name.to_sym)
83
93
  view_class = Kernel.const_get(method_name.to_s)
84
94
  raise "#{view_class.name} is not a known UIView subclass" unless view_class <= UIView
85
- return subview(view_class, *args, &block)
95
+ self.class.add_subview_method(view_class)
96
+
97
+ send method_name, *args, &block
86
98
  else
87
99
  raise "#{method_name} is not defined. Should be a subclass of UIView."
88
100
  end
@@ -1,3 +1,3 @@
1
1
  module MotionPixateLayout
2
- Version = '0.0.5'
2
+ Version = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-pixate-layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-11 00:00:00.000000000 Z
13
+ date: 2013-06-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: motion-pixate