immutable_attributes 1.1.0 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/immutable_attributes.gemspec +19 -19
- data/lib/immutable_attributes.rb +7 -2
- metadata +22 -9
- data/.gitignore +0 -2
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Jack Danger Canty
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ begin
|
|
7
7
|
gem.name = "immutable_attributes"
|
8
8
|
gem.summary = %Q{Selected attributes are permanent once a record is created}
|
9
9
|
gem.description = %Q{Allows specified attributes to be freely overwritten _until_ the record is saved for the first time}
|
10
|
-
gem.email = "
|
10
|
+
gem.email = "gemcutter@jackcanty.com"
|
11
11
|
gem.homepage = "http://github.com/JackDanger/immutable_attributes"
|
12
12
|
gem.authors = ["Jack Danger Canty"]
|
13
13
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
@@ -1,49 +1,49 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{immutable_attributes}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jack Danger Canty"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-04-29}
|
13
13
|
s.description = %q{Allows specified attributes to be freely overwritten _until_ the record is saved for the first time}
|
14
|
-
s.email = %q{
|
14
|
+
s.email = %q{gemcutter@jackcanty.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
16
17
|
"README"
|
17
18
|
]
|
18
19
|
s.files = [
|
19
20
|
".document",
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
"LICENSE",
|
22
|
+
"README",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"immutable_attributes.gemspec",
|
26
|
+
"init.rb",
|
27
|
+
"install.rb",
|
28
|
+
"lib/immutable_attributes.rb",
|
29
|
+
"rails/init.rb",
|
30
|
+
"test/immutable_attributes_test.rb"
|
30
31
|
]
|
31
32
|
s.homepage = %q{http://github.com/JackDanger/immutable_attributes}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
33
33
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.
|
34
|
+
s.rubygems_version = %q{1.4.2}
|
35
35
|
s.summary = %q{Selected attributes are permanent once a record is created}
|
36
36
|
s.test_files = [
|
37
37
|
"test/immutable_attributes_test.rb"
|
38
38
|
]
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
41
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
41
|
s.specification_version = 3
|
43
42
|
|
44
|
-
if Gem::Version.new(Gem::
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
44
|
else
|
46
45
|
end
|
47
46
|
else
|
48
47
|
end
|
49
48
|
end
|
49
|
+
|
data/lib/immutable_attributes.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
require 'activerecord'
|
1
|
+
begin
|
2
|
+
require 'activerecord'
|
3
|
+
rescue LoadError
|
4
|
+
require 'active_record'
|
5
|
+
end
|
3
6
|
|
4
7
|
module ImmutableErrors
|
5
8
|
class ImmutableAttributeError < ActiveRecord::ActiveRecordError
|
@@ -7,6 +10,7 @@ module ImmutableErrors
|
|
7
10
|
end
|
8
11
|
|
9
12
|
module ImmutableAttributes
|
13
|
+
VERSION = "1.0.3"
|
10
14
|
def attr_immutable(*args)
|
11
15
|
args.each do |meth|
|
12
16
|
class_eval do
|
@@ -42,6 +46,7 @@ module ImmutableAttributes
|
|
42
46
|
|
43
47
|
def setup_originals
|
44
48
|
self.class.immutables.each do |attr_name|
|
49
|
+
next unless attribute_names.include? attr_name
|
45
50
|
instance_variable_set("@original_#{attr_name}", send(attr_name.to_s))
|
46
51
|
end
|
47
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immutable_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jack Danger Canty
|
@@ -9,21 +15,22 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-04-29 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
16
22
|
description: Allows specified attributes to be freely overwritten _until_ the record is saved for the first time
|
17
|
-
email:
|
23
|
+
email: gemcutter@jackcanty.com
|
18
24
|
executables: []
|
19
25
|
|
20
26
|
extensions: []
|
21
27
|
|
22
28
|
extra_rdoc_files:
|
29
|
+
- LICENSE
|
23
30
|
- README
|
24
31
|
files:
|
25
32
|
- .document
|
26
|
-
-
|
33
|
+
- LICENSE
|
27
34
|
- README
|
28
35
|
- Rakefile
|
29
36
|
- VERSION
|
@@ -38,26 +45,32 @@ homepage: http://github.com/JackDanger/immutable_attributes
|
|
38
45
|
licenses: []
|
39
46
|
|
40
47
|
post_install_message:
|
41
|
-
rdoc_options:
|
42
|
-
|
48
|
+
rdoc_options: []
|
49
|
+
|
43
50
|
require_paths:
|
44
51
|
- lib
|
45
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
46
54
|
requirements:
|
47
55
|
- - ">="
|
48
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
49
60
|
version: "0"
|
50
|
-
version:
|
51
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
52
63
|
requirements:
|
53
64
|
- - ">="
|
54
65
|
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
67
|
+
segments:
|
68
|
+
- 0
|
55
69
|
version: "0"
|
56
|
-
version:
|
57
70
|
requirements: []
|
58
71
|
|
59
72
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.4.2
|
61
74
|
signing_key:
|
62
75
|
specification_version: 3
|
63
76
|
summary: Selected attributes are permanent once a record is created
|
data/.gitignore
DELETED