maintain 0.1.2 → 0.1.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.
- data/VERSION +1 -1
- data/lib/maintain.rb +15 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/maintain.rb
CHANGED
@@ -96,7 +96,7 @@ module Maintain
|
|
96
96
|
# If'n it doesn't already exist AND this maintained attribute has a default value (and
|
97
97
|
# bitmasks must have at least a 0 value), we'll instantiate a Maintainer::State and return
|
98
98
|
# it.
|
99
|
-
if self.class.maintainers[#{attribute.to_sym.inspect}].default? || self.class.maintainers[#{attribute.to_sym.inspect}].bitmask
|
99
|
+
if self.class.maintainers[#{attribute.to_sym.inspect}].default? || self.class.maintainers[#{attribute.to_sym.inspect}].bitmask?#{" || attributes['#{attribute}']" if active_record}
|
100
100
|
@#{attribute} = self.class.maintainers[#{attribute.to_sym.inspect}].value#{"(read_attribute(:#{attribute}))" if active_record}
|
101
101
|
end
|
102
102
|
end
|
@@ -106,12 +106,26 @@ module Maintain
|
|
106
106
|
# and we'll also modify it instead of replacing it outright, so subclasses or mixins can extend functionality
|
107
107
|
# without replacing it.
|
108
108
|
maintainers[attribute.to_sym] = maintainer
|
109
|
+
#
|
110
|
+
# unless respond_to?(attribute)
|
111
|
+
# class_eval <<-EOC
|
112
|
+
# def #{attribute}
|
113
|
+
# maintainers[#{attribute.to_sym.inspect}]
|
114
|
+
# end
|
115
|
+
# EOC
|
116
|
+
# end
|
109
117
|
end
|
110
118
|
alias :maintains :maintain
|
111
119
|
|
112
120
|
def maintainers #:nodoc:
|
113
121
|
@maintainers ||= {}
|
114
122
|
end
|
123
|
+
|
124
|
+
if File.file?(version_path = File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
125
|
+
VERSION = File.read(version_path).strip
|
126
|
+
else
|
127
|
+
VERSION = '0.0.1'
|
128
|
+
end
|
115
129
|
end
|
116
130
|
|
117
131
|
if defined?(ActiveRecord::Base)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flip Sasser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-31 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|