active_attr 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of active_attr might be problematic. Click here for more details.
- data/.yardopts +1 -1
- data/CHANGELOG.md +8 -1
- data/Gemfile +1 -1
- data/Guardfile +1 -1
- data/Rakefile +12 -2
- data/lib/active_attr.rb +1 -0
- data/lib/active_attr/attribute_definition.rb +1 -1
- data/lib/active_attr/attributes.rb +29 -3
- data/lib/active_attr/chainable_initialization.rb +49 -0
- data/lib/active_attr/mass_assignment.rb +7 -0
- data/lib/active_attr/matchers/have_attribute_matcher.rb +6 -6
- data/lib/active_attr/version.rb +1 -1
- data/spec/functional/active_attr/attributes_spec.rb +111 -0
- data/spec/functional/active_attr/chainable_initialization_spec.rb +93 -0
- data/spec/support/initialization_verifier.rb +9 -0
- data/spec/support/mass_assignment_shared_examples.rb +6 -0
- data/spec/{active_attr → unit/active_attr}/attribute_definition_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/attributes_spec.rb +16 -1
- data/spec/{active_attr → unit/active_attr}/basic_model_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/error_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/mass_assignment_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/matchers/have_attribute_matcher_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/strict_mass_assignment_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/unknown_attributes_error_spec.rb +0 -0
- data/spec/{active_attr → unit/active_attr}/version_spec.rb +0 -0
- metadata +39 -32
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
- CHANGELOG* *LICENSE*
|
1
|
+
--no-private - CHANGELOG* *LICENSE*
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
# ActiveAttr 0.2.
|
1
|
+
# ActiveAttr 0.2.2 (November 2, 2011) #
|
2
|
+
|
3
|
+
* Fixed all instances of modules' #initialize not invoking its superclass
|
4
|
+
* Fixed redefining an attribute appending a new AttributeDefinition
|
5
|
+
* Subclassing a model using Attributes will now copy the parent's attribute
|
6
|
+
definitions to the subclass
|
7
|
+
|
8
|
+
# ActiveAttr 0.2.1 (October 19, 2011) #
|
2
9
|
|
3
10
|
* Added AttributeDefinition#<=>
|
4
11
|
* Added AttributeDefinition#to_sym
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ group :development do
|
|
9
9
|
gem "guard-rspec"
|
10
10
|
gem "rb-fsevent"
|
11
11
|
gem "rdiscount"
|
12
|
-
gem "rdoc"
|
12
|
+
gem "rdoc", "~> 3.9.4"
|
13
13
|
gem "ruby-debug", :platforms => :mri_18
|
14
14
|
gem "ruby-debug19", :platforms => :mri_19 if RUBY_VERSION < "1.9.3"
|
15
15
|
gem "spec_coverage", :platforms => :mri_19
|
data/Guardfile
CHANGED
@@ -5,7 +5,7 @@ end
|
|
5
5
|
|
6
6
|
guard "rspec", :version => 2, :cli=> "--format nested --debugger" do
|
7
7
|
watch(%r{^spec/.+_spec\.rb$})
|
8
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| ["spec/unit/#{m[1]}_spec.rb", "spec/functional/#{m[1]}_spec.rb"] }
|
9
9
|
watch("spec/spec_helper.rb") { "spec" }
|
10
10
|
watch(%r{^spec/support/(.+)\.rb$}) { |m| "spec" }
|
11
11
|
end
|
data/Rakefile
CHANGED
@@ -2,13 +2,23 @@ require "bundler/setup"
|
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
4
|
|
5
|
-
task :default =>
|
5
|
+
task :default => :spec
|
6
6
|
|
7
|
-
|
7
|
+
task :spec => %w(spec:units spec:functionals)
|
8
8
|
|
9
9
|
namespace :spec do
|
10
10
|
desc "Run RSpec specs with code coverate analysis"
|
11
11
|
RSpec::Core::RakeTask.new(:cov) do |spec|
|
12
12
|
spec.rspec_opts = "--format nested --format SpecCoverage"
|
13
13
|
end
|
14
|
+
|
15
|
+
desc "Run RSpec unit specs"
|
16
|
+
RSpec::Core::RakeTask.new(:units) do |spec|
|
17
|
+
spec.pattern = "spec/unit/**/*_spec.rb"
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Run RSpec functional specs"
|
21
|
+
RSpec::Core::RakeTask.new(:functionals) do |spec|
|
22
|
+
spec.pattern = "spec/functional/**/*_spec.rb"
|
23
|
+
end
|
14
24
|
end
|
data/lib/active_attr.rb
CHANGED
@@ -32,7 +32,7 @@ module ActiveAttr
|
|
32
32
|
# @example Create an attribute defintion
|
33
33
|
# AttributeDefinition.new(:amount)
|
34
34
|
#
|
35
|
-
# @param [Symbol, String, #to_sym] attribute name
|
35
|
+
# @param [Symbol, String, #to_sym] name attribute name
|
36
36
|
#
|
37
37
|
# @return [ActiveAttr::AttributeDefinition]
|
38
38
|
#
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "active_attr/attribute_definition"
|
2
|
+
require "active_attr/chainable_initialization"
|
2
3
|
require "active_model"
|
3
4
|
require "active_support/concern"
|
4
5
|
|
@@ -18,6 +19,7 @@ module ActiveAttr
|
|
18
19
|
# @since 0.2.0
|
19
20
|
module Attributes
|
20
21
|
extend ActiveSupport::Concern
|
22
|
+
include ActiveAttr::ChainableInitialization
|
21
23
|
include ActiveModel::AttributeMethods
|
22
24
|
|
23
25
|
included do
|
@@ -54,8 +56,9 @@ module ActiveAttr
|
|
54
56
|
end
|
55
57
|
|
56
58
|
# @since 0.2.1
|
57
|
-
def initialize(*
|
59
|
+
def initialize(*)
|
58
60
|
@attributes ||= {}
|
61
|
+
super
|
59
62
|
end
|
60
63
|
|
61
64
|
# Returns the class name plus its attributes
|
@@ -119,12 +122,12 @@ module ActiveAttr
|
|
119
122
|
# @example Define an attribute.
|
120
123
|
# attribute :name
|
121
124
|
#
|
122
|
-
# @param
|
125
|
+
# @param (see AttributeDefinition#initialize)
|
123
126
|
#
|
124
127
|
# @since 0.2.0
|
125
128
|
def attribute(name, options={})
|
126
129
|
AttributeDefinition.new(name, options).tap do |attribute_definition|
|
127
|
-
attributes << attribute_definition
|
130
|
+
attributes << attribute_definition unless attributes.include? attribute_definition
|
128
131
|
define_attribute_method attribute_definition.name
|
129
132
|
end
|
130
133
|
end
|
@@ -154,6 +157,29 @@ module ActiveAttr
|
|
154
157
|
attributes_list = "(#{inspected_attributes.join(", ")})" unless inspected_attributes.empty?
|
155
158
|
"#{self.name}#{attributes_list}"
|
156
159
|
end
|
160
|
+
|
161
|
+
protected
|
162
|
+
|
163
|
+
# Assign a set of attribute definitions, used when subclassing models
|
164
|
+
#
|
165
|
+
# @param [Array<ActiveAttr::AttributeDefinition>] The Array of AttributeDefinition instances
|
166
|
+
#
|
167
|
+
# @since 0.2.2
|
168
|
+
def attributes=(attributes)
|
169
|
+
@attributes = attributes
|
170
|
+
end
|
171
|
+
|
172
|
+
private
|
173
|
+
|
174
|
+
# Ruby inherited hook to assign superclass attributes to subclasses
|
175
|
+
#
|
176
|
+
# @param [Class] subclass
|
177
|
+
#
|
178
|
+
# @since 0.2.2
|
179
|
+
def inherited(subclass)
|
180
|
+
super
|
181
|
+
subclass.attributes = attributes.dup
|
182
|
+
end
|
157
183
|
end
|
158
184
|
end
|
159
185
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ActiveAttr
|
2
|
+
# Allows classes and modules to safely invoke super in its initialize method
|
3
|
+
#
|
4
|
+
# Many ActiveAttr modules enhance the behavior of the \#initialize method,
|
5
|
+
# and in doing so, these methods need to accept arguments. However, Ruby's
|
6
|
+
# Object and BasicObject classes, in most versions of Ruby, do not allow any
|
7
|
+
# arguments to be passed in. This module halts the propgation of
|
8
|
+
# initialization arguments before invoking the Object classes'
|
9
|
+
# initialization.
|
10
|
+
#
|
11
|
+
# In order to still allow a subclass mixing in this module (directly or
|
12
|
+
# through an ActiveSupport::Concern) to still pass its initialization
|
13
|
+
# arguments to its superclass, the module has to install itself into the
|
14
|
+
# ancestors of the base class, the class that inherits directly from Object
|
15
|
+
# or BasicObject.
|
16
|
+
#
|
17
|
+
# @since 0.2.2
|
18
|
+
module ChainableInitialization
|
19
|
+
class << self
|
20
|
+
# A collection of Ruby base objects
|
21
|
+
# [Object] on Ruby 1.8
|
22
|
+
# [Object, BasicObject] on Ruby 1.9
|
23
|
+
BASE_OBJECTS = begin
|
24
|
+
base_objects = []
|
25
|
+
superclass = Class.new
|
26
|
+
base_objects << superclass while superclass = superclass.superclass
|
27
|
+
base_objects
|
28
|
+
end
|
29
|
+
|
30
|
+
# Only append the features of this module to the class that inherits
|
31
|
+
# directly from one of the BASE_OBJECTS
|
32
|
+
def append_features(base)
|
33
|
+
if base.respond_to? :superclass
|
34
|
+
base = base.superclass while !BASE_OBJECTS.include?(base.superclass)
|
35
|
+
end
|
36
|
+
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Continue to propagate any superclass calls, but stop passing arguments
|
42
|
+
#
|
43
|
+
# This prevents problems in versions of Ruby where Object#initialize does
|
44
|
+
# not take arguments
|
45
|
+
def initialize(*)
|
46
|
+
super()
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require "active_attr/chainable_initialization"
|
2
|
+
require "active_support/concern"
|
3
|
+
|
1
4
|
module ActiveAttr
|
2
5
|
# MassAssignment allows you to bulk set and update attributes
|
3
6
|
#
|
@@ -11,6 +14,9 @@ module ActiveAttr
|
|
11
14
|
#
|
12
15
|
# @since 0.1.0
|
13
16
|
module MassAssignment
|
17
|
+
extend ActiveSupport::Concern
|
18
|
+
include ChainableInitialization
|
19
|
+
|
14
20
|
# Mass update a model's attributes
|
15
21
|
#
|
16
22
|
# @example Assigning a hash
|
@@ -54,6 +60,7 @@ module ActiveAttr
|
|
54
60
|
# @since 0.1.0
|
55
61
|
def initialize(attributes=nil, options={})
|
56
62
|
assign_attributes attributes, options
|
63
|
+
super
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
@@ -22,29 +22,29 @@ module ActiveAttr
|
|
22
22
|
# @since 0.2.0
|
23
23
|
class HaveAttributeMatcher
|
24
24
|
# @return [Symbol]
|
25
|
-
# @
|
25
|
+
# @private
|
26
26
|
attr_reader :attribute_name
|
27
27
|
|
28
28
|
# @return [String] Description
|
29
|
-
# @
|
29
|
+
# @private
|
30
30
|
def description
|
31
31
|
"have attribute named #{attribute_name}"
|
32
32
|
end
|
33
33
|
|
34
34
|
# @return [String] Failure message
|
35
|
-
# @
|
35
|
+
# @private
|
36
36
|
def failure_message
|
37
37
|
"Expected #{@model_class} to #{description}"
|
38
38
|
end
|
39
39
|
|
40
40
|
# @param [Symbol, String, #to_sym] attribute_name
|
41
|
-
# @
|
41
|
+
# @private
|
42
42
|
def initialize(attribute_name)
|
43
43
|
raise TypeError, "can't convert #{attribute_name.class} into Symbol" unless attribute_name.respond_to? :to_sym
|
44
44
|
@attribute_name = attribute_name.to_sym
|
45
45
|
end
|
46
46
|
|
47
|
-
# @
|
47
|
+
# @private
|
48
48
|
def matches?(model_or_model_class)
|
49
49
|
@model_class = class_from(model_or_model_class)
|
50
50
|
|
@@ -54,7 +54,7 @@ module ActiveAttr
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# @return [String] Negative failure message
|
57
|
-
# @
|
57
|
+
# @private
|
58
58
|
def negative_failure_message
|
59
59
|
"Expected #{@model_class} to not #{description}"
|
60
60
|
end
|
data/lib/active_attr/version.rb
CHANGED
@@ -0,0 +1,111 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "active_attr/attributes"
|
3
|
+
require "active_model"
|
4
|
+
|
5
|
+
module ActiveAttr
|
6
|
+
describe Attributes do
|
7
|
+
context "subclassing a model" do
|
8
|
+
let :parent_class do
|
9
|
+
Class.new do
|
10
|
+
include Attributes
|
11
|
+
|
12
|
+
attribute :parent
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let! :child_class do
|
17
|
+
Class.new(parent_class) do
|
18
|
+
attribute :child
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "attributes defined on the parent" do
|
23
|
+
subject { child_class.new }
|
24
|
+
|
25
|
+
it "create a reader on the child" do
|
26
|
+
should respond_to :parent
|
27
|
+
end
|
28
|
+
|
29
|
+
it "create a writer on the child" do
|
30
|
+
should respond_to :parent=
|
31
|
+
end
|
32
|
+
|
33
|
+
it "add attribute definitions to the child" do
|
34
|
+
child_class.attributes.map(&:name).should include :parent
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "attributes defined on the child" do
|
39
|
+
subject { parent_class.new }
|
40
|
+
|
41
|
+
it "don't create a reader on the parent" do
|
42
|
+
should_not respond_to :child
|
43
|
+
end
|
44
|
+
|
45
|
+
it "don't create a writer on the parent" do
|
46
|
+
should_not respond_to :child=
|
47
|
+
end
|
48
|
+
|
49
|
+
it "don't add attribute definitions to the parent" do
|
50
|
+
parent_class.attributes.map(&:name).should_not include :child
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "serializing a model" do
|
56
|
+
let(:first_name) { "Chris" }
|
57
|
+
|
58
|
+
let :instance do
|
59
|
+
model_class.new.tap do |model|
|
60
|
+
model.first_name = first_name
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
let :model_class do
|
65
|
+
Class.new do
|
66
|
+
include Attributes
|
67
|
+
include ActiveModel::Serializers::JSON
|
68
|
+
include ActiveModel::Serializers::Xml
|
69
|
+
|
70
|
+
attribute :first_name
|
71
|
+
attribute :last_name
|
72
|
+
|
73
|
+
def self.name
|
74
|
+
"Person"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
shared_examples "serialization method" do
|
80
|
+
it "includes assigned attributes" do
|
81
|
+
should include("first_name" => first_name)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "includes unassigned, defined attributes" do
|
85
|
+
subject.keys.should include("last_name")
|
86
|
+
subject["last_name"].should be_nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "#as_json" do
|
91
|
+
subject { instance.as_json["person"] }
|
92
|
+
include_examples "serialization method"
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#serializable_hash" do
|
96
|
+
subject { instance.serializable_hash }
|
97
|
+
include_examples "serialization method"
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "#to_json" do
|
101
|
+
subject { ActiveSupport::JSON.decode(instance.to_json)["person"] }
|
102
|
+
include_examples "serialization method"
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "#to_xml" do
|
106
|
+
subject { Hash.from_xml(instance.to_xml)["person"] }
|
107
|
+
include_examples "serialization method"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "active_attr/chainable_initialization"
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module ActiveAttr
|
6
|
+
describe ChainableInitialization do
|
7
|
+
subject { model_class.new("arg") }
|
8
|
+
|
9
|
+
shared_examples "chained initialization" do
|
10
|
+
describe "#initialize" do
|
11
|
+
it { expect { subject }.not_to raise_error }
|
12
|
+
it { subject.initialized?.should be_true }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "mixed into a class with an argument to initialize" do
|
17
|
+
let :model_class do
|
18
|
+
Class.new do
|
19
|
+
include InitializationVerifier
|
20
|
+
include ChainableInitialization
|
21
|
+
|
22
|
+
def initialize(arg)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
include_examples "chained initialization"
|
29
|
+
end
|
30
|
+
|
31
|
+
context "mixed into a subclass with an argument to initialize on the superclass" do
|
32
|
+
context "subclassing a model" do
|
33
|
+
let :parent_class do
|
34
|
+
Class.new do
|
35
|
+
include InitializationVerifier
|
36
|
+
|
37
|
+
def initialize(arg)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
let :model_class do
|
44
|
+
Class.new(parent_class) do
|
45
|
+
include ChainableInitialization
|
46
|
+
|
47
|
+
def initialize(arg)
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
include_examples "chained initialization"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "mixed into a concern which is mixed into a class with an argument to initialize" do
|
58
|
+
let :model_class do
|
59
|
+
Class.new do
|
60
|
+
include InitializationVerifier
|
61
|
+
|
62
|
+
include Module.new {
|
63
|
+
extend ActiveSupport::Concern
|
64
|
+
include ChainableInitialization
|
65
|
+
}
|
66
|
+
|
67
|
+
def initialize(arg)
|
68
|
+
super
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
include_examples "chained initialization"
|
74
|
+
end
|
75
|
+
|
76
|
+
if defined?(BasicObject)
|
77
|
+
context "mixed into a class that inherits from BasicObject with an argument to initialize" do
|
78
|
+
let :model_class do
|
79
|
+
Class.new(BasicObject) do
|
80
|
+
include InitializationVerifier
|
81
|
+
include ChainableInitialization
|
82
|
+
|
83
|
+
def initialize(arg)
|
84
|
+
super
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
include_examples "chained initialization"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
shared_examples "mass assignment class", :mass_assignment => true do
|
2
2
|
let :model_class do
|
3
3
|
Class.new do
|
4
|
+
include InitializationVerifier
|
5
|
+
|
4
6
|
attr_accessor :first_name, :last_name, :middle_name
|
5
7
|
private :middle_name=
|
6
8
|
|
@@ -77,6 +79,10 @@ shared_examples "#initialize", :initialize => true do
|
|
77
79
|
subject.new(attributes)
|
78
80
|
end
|
79
81
|
|
82
|
+
it "invokes the superclass initializer" do
|
83
|
+
subject.new.should be_initialized
|
84
|
+
end
|
85
|
+
|
80
86
|
it "raises ArgumentError when called with three arguments" do
|
81
87
|
expect { subject.new({}, {}, nil) }.to raise_error ArgumentError
|
82
88
|
end
|
File without changes
|
@@ -7,6 +7,7 @@ module ActiveAttr
|
|
7
7
|
|
8
8
|
let :model_class do
|
9
9
|
Class.new do
|
10
|
+
include InitializationVerifier
|
10
11
|
include Attributes
|
11
12
|
attribute :name
|
12
13
|
attribute :amount
|
@@ -19,7 +20,7 @@ module ActiveAttr
|
|
19
20
|
super
|
20
21
|
end
|
21
22
|
|
22
|
-
def amount=(*
|
23
|
+
def amount=(*)
|
23
24
|
super
|
24
25
|
end
|
25
26
|
|
@@ -68,6 +69,14 @@ module ActiveAttr
|
|
68
69
|
subject.should_receive(:attribute=).with("amount", 1)
|
69
70
|
subject.amount = 1
|
70
71
|
end
|
72
|
+
|
73
|
+
it "defining an attribute twice does not make appear in the" do
|
74
|
+
Class.new do
|
75
|
+
include Attributes
|
76
|
+
attribute :name
|
77
|
+
attribute :name
|
78
|
+
end.should have(1).attributes
|
79
|
+
end
|
71
80
|
end
|
72
81
|
|
73
82
|
describe ".attributes" do
|
@@ -143,6 +152,12 @@ module ActiveAttr
|
|
143
152
|
end
|
144
153
|
end
|
145
154
|
|
155
|
+
describe "#initialize" do
|
156
|
+
it "invokes the superclass initializer" do
|
157
|
+
should be_initialized
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
146
161
|
describe "#inspect" do
|
147
162
|
before { subject.name = "Ben" }
|
148
163
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-11-02 00:00:00.000000000 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activemodel
|
18
|
-
requirement: &
|
18
|
+
requirement: &70194693834500 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '3.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70194693834500
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
|
-
requirement: &
|
29
|
+
requirement: &70194693833280 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '3.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70194693833280
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: bundler
|
40
|
-
requirement: &
|
40
|
+
requirement: &70194693832400 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '1.0'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70194693832400
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rake
|
51
|
-
requirement: &
|
51
|
+
requirement: &70194693831640 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.9.0
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70194693831640
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rspec
|
62
|
-
requirement: &
|
62
|
+
requirement: &70194693830660 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
version: '2.6'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70194693830660
|
71
71
|
description: Create plain old ruby models without reinventing the wheel.
|
72
72
|
email:
|
73
73
|
- cgriego@gmail.com
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/active_attr/attribute_definition.rb
|
93
93
|
- lib/active_attr/attributes.rb
|
94
94
|
- lib/active_attr/basic_model.rb
|
95
|
+
- lib/active_attr/chainable_initialization.rb
|
95
96
|
- lib/active_attr/error.rb
|
96
97
|
- lib/active_attr/mass_assignment.rb
|
97
98
|
- lib/active_attr/matchers.rb
|
@@ -100,18 +101,21 @@ files:
|
|
100
101
|
- lib/active_attr/strict_mass_assignment.rb
|
101
102
|
- lib/active_attr/unknown_attributes_error.rb
|
102
103
|
- lib/active_attr/version.rb
|
103
|
-
- spec/active_attr/
|
104
|
-
- spec/active_attr/
|
105
|
-
- spec/active_attr/basic_model_spec.rb
|
106
|
-
- spec/active_attr/error_spec.rb
|
107
|
-
- spec/active_attr/mass_assignment_spec.rb
|
108
|
-
- spec/active_attr/matchers/have_attribute_matcher_spec.rb
|
109
|
-
- spec/active_attr/strict_mass_assignment_spec.rb
|
110
|
-
- spec/active_attr/unknown_attributes_error_spec.rb
|
111
|
-
- spec/active_attr/version_spec.rb
|
104
|
+
- spec/functional/active_attr/attributes_spec.rb
|
105
|
+
- spec/functional/active_attr/chainable_initialization_spec.rb
|
112
106
|
- spec/spec_helper.rb
|
113
107
|
- spec/support/active_model_lint.rb
|
108
|
+
- spec/support/initialization_verifier.rb
|
114
109
|
- spec/support/mass_assignment_shared_examples.rb
|
110
|
+
- spec/unit/active_attr/attribute_definition_spec.rb
|
111
|
+
- spec/unit/active_attr/attributes_spec.rb
|
112
|
+
- spec/unit/active_attr/basic_model_spec.rb
|
113
|
+
- spec/unit/active_attr/error_spec.rb
|
114
|
+
- spec/unit/active_attr/mass_assignment_spec.rb
|
115
|
+
- spec/unit/active_attr/matchers/have_attribute_matcher_spec.rb
|
116
|
+
- spec/unit/active_attr/strict_mass_assignment_spec.rb
|
117
|
+
- spec/unit/active_attr/unknown_attributes_error_spec.rb
|
118
|
+
- spec/unit/active_attr/version_spec.rb
|
115
119
|
has_rdoc: true
|
116
120
|
homepage: https://github.com/cgriego/active_attr
|
117
121
|
licenses: []
|
@@ -127,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
131
|
version: '0'
|
128
132
|
segments:
|
129
133
|
- 0
|
130
|
-
hash:
|
134
|
+
hash: 2011553241576823901
|
131
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
136
|
none: false
|
133
137
|
requirements:
|
@@ -136,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
140
|
version: '0'
|
137
141
|
segments:
|
138
142
|
- 0
|
139
|
-
hash:
|
143
|
+
hash: 2011553241576823901
|
140
144
|
requirements: []
|
141
145
|
rubyforge_project: active_attr
|
142
146
|
rubygems_version: 1.5.2
|
@@ -144,15 +148,18 @@ signing_key:
|
|
144
148
|
specification_version: 3
|
145
149
|
summary: What ActiveModel left out
|
146
150
|
test_files:
|
147
|
-
- spec/active_attr/
|
148
|
-
- spec/active_attr/
|
149
|
-
- spec/active_attr/basic_model_spec.rb
|
150
|
-
- spec/active_attr/error_spec.rb
|
151
|
-
- spec/active_attr/mass_assignment_spec.rb
|
152
|
-
- spec/active_attr/matchers/have_attribute_matcher_spec.rb
|
153
|
-
- spec/active_attr/strict_mass_assignment_spec.rb
|
154
|
-
- spec/active_attr/unknown_attributes_error_spec.rb
|
155
|
-
- spec/active_attr/version_spec.rb
|
151
|
+
- spec/functional/active_attr/attributes_spec.rb
|
152
|
+
- spec/functional/active_attr/chainable_initialization_spec.rb
|
156
153
|
- spec/spec_helper.rb
|
157
154
|
- spec/support/active_model_lint.rb
|
155
|
+
- spec/support/initialization_verifier.rb
|
158
156
|
- spec/support/mass_assignment_shared_examples.rb
|
157
|
+
- spec/unit/active_attr/attribute_definition_spec.rb
|
158
|
+
- spec/unit/active_attr/attributes_spec.rb
|
159
|
+
- spec/unit/active_attr/basic_model_spec.rb
|
160
|
+
- spec/unit/active_attr/error_spec.rb
|
161
|
+
- spec/unit/active_attr/mass_assignment_spec.rb
|
162
|
+
- spec/unit/active_attr/matchers/have_attribute_matcher_spec.rb
|
163
|
+
- spec/unit/active_attr/strict_mass_assignment_spec.rb
|
164
|
+
- spec/unit/active_attr/unknown_attributes_error_spec.rb
|
165
|
+
- spec/unit/active_attr/version_spec.rb
|