organizze-form 0.0.2 → 0.0.3
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 +4 -4
- data/lib/organizze-form/row.rb +35 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d4d3fe00dc9769dc32c4e7488e30e893207239b
|
4
|
+
data.tar.gz: a328b0cfb7e831c0b191f16aa7ad0c2ec9acb7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f7a0cf33138166d2dd08f518399f28d9c62e0568937455804f84f55e3819080cf4de8b7c8f51105a39bb763d7c5d4daf64a52b4e9d5b9b024473958eab4838
|
7
|
+
data.tar.gz: b689854eccc13a9899cfeb3d65e17c2732af9947ce4fcd098cd6bc3b88694a241930cdaaed644796aed86628f5f2a2eaa0cafd4998b626b644da48b4c3b4483f
|
data/lib/organizze-form/row.rb
CHANGED
@@ -3,7 +3,7 @@ module OrganizzeForm
|
|
3
3
|
attr_accessor :type, :key, :value
|
4
4
|
|
5
5
|
def row_type
|
6
|
-
@row_type ||= row_type_class.new.tap do |rt|
|
6
|
+
@row_type ||= row_type_class.new.tap do |rt|
|
7
7
|
rt.row = WeakRef.new(self)
|
8
8
|
end
|
9
9
|
end
|
@@ -12,17 +12,45 @@ module OrganizzeForm
|
|
12
12
|
row_type.setup_call
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
private
|
16
|
+
|
17
|
+
def row_type_class
|
18
|
+
constantize("OrganizzeForm::RowTypes::#{camelize(self.type)}")
|
17
19
|
end
|
18
20
|
|
19
21
|
def camelize(term)
|
20
|
-
parts = term.
|
21
|
-
|
22
|
+
parts = term.split('_')
|
23
|
+
camel_cased_word = ''
|
22
24
|
for p in parts
|
23
|
-
|
25
|
+
camel_cased_word << p.capitalize
|
26
|
+
end
|
27
|
+
camel_cased_word
|
28
|
+
end
|
29
|
+
|
30
|
+
def constantize(camel_cased_word)
|
31
|
+
names = camel_cased_word.split('::')
|
32
|
+
names.shift if names.empty? || names.first.empty?
|
33
|
+
|
34
|
+
names.inject(Object) do |constant, name|
|
35
|
+
if constant == Object
|
36
|
+
constant.const_get(name)
|
37
|
+
else
|
38
|
+
candidate = constant.const_get(name)
|
39
|
+
next candidate if constant.const_defined?(name, false)
|
40
|
+
next candidate unless Object.const_defined?(name)
|
41
|
+
|
42
|
+
# Go down the ancestors to check it it's owned
|
43
|
+
# directly before we reach Object or the end of ancestors.
|
44
|
+
constant = constant.ancestors.inject do |const, ancestor|
|
45
|
+
break const if ancestor == Object
|
46
|
+
break ancestor if ancestor.const_defined?(name, false)
|
47
|
+
const
|
48
|
+
end
|
49
|
+
|
50
|
+
# owner is in Object, so raise
|
51
|
+
constant.const_get(name, false)
|
52
|
+
end
|
24
53
|
end
|
25
|
-
str
|
26
54
|
end
|
27
55
|
end
|
28
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: organizze-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Felipe Colle da Luz
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
description: Simple rubymotion form helper for
|
27
|
+
description: Simple rubymotion form helper for UITableViews
|
28
28
|
email:
|
29
29
|
- solanoluz@gmail.com
|
30
30
|
executables: []
|