attr_default 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/attr_default/version.rb +1 -1
- data/lib/attr_default.rb +1 -1
- metadata +100 -93
data/lib/attr_default/version.rb
CHANGED
data/lib/attr_default.rb
CHANGED
@@ -47,7 +47,7 @@ module AttrDefault
|
|
47
47
|
attr_name = attr_name.to_s
|
48
48
|
if self.class._attr_defaults.has_key?(attr_name)
|
49
49
|
attr_default = self.class._attr_defaults[attr_name]
|
50
|
-
attr_default.is_a?(Proc) ?
|
50
|
+
attr_default.is_a?(Proc) ? instance_exec(&attr_default) : (attr_default.dup rescue attr_default)
|
51
51
|
else
|
52
52
|
column_data = self.class.columns_hash[attr_name] or raise ArgumentError, "#{self.class.name}##{attr_name} not found"
|
53
53
|
column_data.default
|
metadata
CHANGED
@@ -1,100 +1,104 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_default
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 5
|
8
|
-
- 6
|
9
|
-
version: 0.5.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.7
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Colin Kelley
|
13
9
|
- Nick Burwell
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
13
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
25
20
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 1
|
30
|
-
- 0
|
21
|
+
- !ruby/object:Gem::Version
|
31
22
|
version: 1.1.0
|
32
|
-
name: rack
|
33
|
-
requirement: *id001
|
34
|
-
prerelease: false
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
23
|
type: :development
|
37
|
-
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
39
28
|
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
- 9
|
44
|
-
version: "0.9"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.1.0
|
31
|
+
- !ruby/object:Gem::Dependency
|
45
32
|
name: rake
|
46
|
-
requirement:
|
47
|
-
|
48
|
-
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0.9'
|
49
39
|
type: :development
|
50
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 2
|
56
|
-
- 3
|
57
|
-
- 14
|
58
|
-
version: 2.3.14
|
59
|
-
name: rails
|
60
|
-
requirement: *id003
|
61
40
|
prerelease: false
|
62
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.9'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.3.14
|
63
55
|
type: :development
|
64
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
segments:
|
69
|
-
- 0
|
70
|
-
version: "0"
|
71
|
-
name: sqlite3
|
72
|
-
requirement: *id004
|
73
56
|
prerelease: false
|
74
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.3.14
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: sqlite3
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
75
71
|
type: :development
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
version: 0.9.103
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
85
80
|
name: hobofields
|
86
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - '='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.9.103
|
87
|
+
type: :development
|
87
88
|
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - '='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.9.103
|
88
95
|
description: Dynamic Ruby defaults for ActiveRecord attributes
|
89
|
-
email:
|
96
|
+
email:
|
90
97
|
- colindkelley@gmail.com
|
91
98
|
executables: []
|
92
|
-
|
93
99
|
extensions: []
|
94
|
-
|
95
100
|
extra_rdoc_files: []
|
96
|
-
|
97
|
-
files:
|
101
|
+
files:
|
98
102
|
- .gitignore
|
99
103
|
- Gemfile
|
100
104
|
- LICENSE
|
@@ -105,35 +109,38 @@ files:
|
|
105
109
|
- lib/attr_default/railtie.rb
|
106
110
|
- lib/attr_default/version.rb
|
107
111
|
- test/test_attr_default.rb
|
108
|
-
has_rdoc: true
|
109
112
|
homepage: https://github.com/RingRevenue/attr_default
|
110
113
|
licenses: []
|
111
|
-
|
112
114
|
post_install_message:
|
113
115
|
rdoc_options: []
|
114
|
-
|
115
|
-
require_paths:
|
116
|
+
require_paths:
|
116
117
|
- lib
|
117
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
segments:
|
122
125
|
- 0
|
123
|
-
|
124
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
hash: -3904188318678435227
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
segments:
|
129
134
|
- 0
|
130
|
-
|
135
|
+
hash: -3904188318678435227
|
131
136
|
requirements: []
|
132
|
-
|
133
137
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.8.25
|
135
139
|
signing_key:
|
136
140
|
specification_version: 3
|
137
|
-
summary:
|
138
|
-
|
141
|
+
summary: ! 'Dynamic Ruby defaults for ActiveRecord attributes. These are lazy evaluated
|
142
|
+
just in time: when first accessed, or just before validation or save. This allows
|
143
|
+
dynamic defaults to depend on attributes that are assigned after initialization,
|
144
|
+
or on other dynamic defaults.'
|
145
|
+
test_files:
|
139
146
|
- test/test_attr_default.rb
|