extend_at 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/extend_at.gemspec +2 -2
- data/lib/extend_at/model_manager.rb +24 -0
- data/lib/extend_at/version.rb +1 -1
- metadata +10 -10
data/extend_at.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Andrés José Borek"]
|
9
9
|
s.email = ["andres.b.dev@gmail.com"]
|
10
10
|
s.homepage = ""
|
11
|
-
s.summary = %q{Create dynamic fields to extend models (like content types in Drupal)}
|
12
|
-
s.description = %q{This gem allows you to extend models without migrations: This way you can, i.e., develop your own content types, like in Drupal.}
|
11
|
+
s.summary = %q{Create dynamic fields to extend rails models (like content types in Drupal)}
|
12
|
+
s.description = %q{This gem allows you to extend rails models without migrations: This way you can, i.e., develop your own content types, like in Drupal.}
|
13
13
|
|
14
14
|
s.rubyforge_project = "extend_at"
|
15
15
|
|
@@ -40,6 +40,22 @@ module ExtendModelAt
|
|
40
40
|
model.try(:value)
|
41
41
|
end
|
42
42
|
|
43
|
+
def each()
|
44
|
+
array = []
|
45
|
+
if yield.parameters.size == 1
|
46
|
+
all_values.each do |value|
|
47
|
+
array << yield value
|
48
|
+
end
|
49
|
+
elsif yield.parameters.size == 2
|
50
|
+
all_hash.each do |key, value|
|
51
|
+
array << yield key, value
|
52
|
+
end
|
53
|
+
else
|
54
|
+
raise "Invalid numbers of parameters"
|
55
|
+
end
|
56
|
+
array
|
57
|
+
end
|
58
|
+
|
43
59
|
def all_values
|
44
60
|
@extend_at.extend_at_columns.map(&:column).try(:map,&:value)
|
45
61
|
end
|
@@ -57,6 +73,14 @@ module ExtendModelAt
|
|
57
73
|
hash
|
58
74
|
end
|
59
75
|
|
76
|
+
def to_a
|
77
|
+
all_values
|
78
|
+
end
|
79
|
+
|
80
|
+
def to_hash
|
81
|
+
all_hash
|
82
|
+
end
|
83
|
+
|
60
84
|
protected
|
61
85
|
def get_column_model(column)
|
62
86
|
type = get_type column
|
data/lib/extend_at/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extend_at
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &21676760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21676760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &21676220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.5'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21676220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-core
|
38
|
-
requirement: &
|
38
|
+
requirement: &21675820 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,9 +43,9 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
description: ! 'This gem allows you to extend models without migrations: This
|
48
|
-
you can, i.e., develop your own content types, like in Drupal.'
|
46
|
+
version_requirements: *21675820
|
47
|
+
description: ! 'This gem allows you to extend rails models without migrations: This
|
48
|
+
way you can, i.e., develop your own content types, like in Drupal.'
|
49
49
|
email:
|
50
50
|
- andres.b.dev@gmail.com
|
51
51
|
executables: []
|
@@ -102,5 +102,5 @@ rubyforge_project: extend_at
|
|
102
102
|
rubygems_version: 1.8.11
|
103
103
|
signing_key:
|
104
104
|
specification_version: 3
|
105
|
-
summary: Create dynamic fields to extend models (like content types in Drupal)
|
105
|
+
summary: Create dynamic fields to extend rails models (like content types in Drupal)
|
106
106
|
test_files: []
|