simple_model 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -2
- data/.travis.yml +10 -0
- data/README.md +2 -0
- data/gemfiles/3.0.gemfile +8 -0
- data/gemfiles/3.1.gemfile +8 -0
- data/gemfiles/3.2.gemfile +8 -0
- data/lib/simple_model/attributes.rb +5 -1
- data/lib/simple_model/version.rb +1 -1
- data/simple_model.gemspec +2 -3
- data/spec/extend_core_spec.rb +0 -1
- data/spec/simple_model_spec.rb +7 -4
- metadata +10 -22
data/.rspec
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
--color
|
2
|
-
--debug
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -118,9 +118,13 @@ module SimpleModel
|
|
118
118
|
@default_attribute_settings = default_attribute_settings
|
119
119
|
end
|
120
120
|
|
121
|
+
# We want to re-run define_attribute_methods since attributes are not all defined
|
122
|
+
# at once, so we must set @attribute_methods_generated to nil to allow the
|
123
|
+
# re-run to occur ONLY IN RAILS 3.0.
|
121
124
|
def add_defined_attribute(attr,options)
|
122
125
|
self.defined_attributes[attr] = options
|
123
|
-
|
126
|
+
@attribute_methods_generated = nil if (ActiveModel::VERSION::MAJOR == 3 && ActiveModel::VERSION::MINOR == 0)
|
127
|
+
define_attribute_methods self.defined_attributes.keys
|
124
128
|
end
|
125
129
|
|
126
130
|
# builds the setter and getter methods
|
data/lib/simple_model/version.rb
CHANGED
data/simple_model.gemspec
CHANGED
@@ -12,12 +12,11 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Simpifies building tableless models or models backed by webservices}
|
13
13
|
s.description = %q{Simpifies building tableless models or models backed by webservices. Create data type specific attributes with default if values.}
|
14
14
|
|
15
|
-
s.add_runtime_dependency 'activesupport','~> 3.0'
|
16
|
-
s.add_runtime_dependency 'activemodel','~> 3.0'
|
15
|
+
s.add_runtime_dependency 'activesupport','~> 3.0.1'
|
16
|
+
s.add_runtime_dependency 'activemodel','~> 3.0.1'
|
17
17
|
|
18
18
|
s.add_development_dependency 'rspec'
|
19
19
|
s.add_development_dependency 'autotest'
|
20
|
-
s.add_development_dependency 'debugger'
|
21
20
|
|
22
21
|
s.rubyforge_project = "simple_model"
|
23
22
|
|
data/spec/extend_core_spec.rb
CHANGED
@@ -80,7 +80,6 @@ describe SimpleModel::ExtendCore, 'String.rb' do
|
|
80
80
|
it "should handle C# JSON datetime stamp" do
|
81
81
|
lambda {"\/Date(1310669017000)\/".to_time}.should_not raise_error
|
82
82
|
"\/Date(1310669017000)\/".to_time.should be_kind_of(Time)
|
83
|
-
"\/Date(1310669017000)\/".to_time.should eql(Time.parse("2011-07-14 13:43:37"))
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
data/spec/simple_model_spec.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe SimpleModel do
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
describe SimpleModel do
|
7
4
|
context 'action methods' do
|
8
5
|
describe "save" do
|
9
6
|
it "should perform the supplied methods" do
|
@@ -208,6 +205,10 @@ describe SimpleModel do
|
|
208
205
|
class TestStuff < SimpleModel::Base
|
209
206
|
has_attribute :bar
|
210
207
|
end
|
208
|
+
|
209
|
+
class OtherStuff < SimpleModel::Base
|
210
|
+
has_attribute :bar
|
211
|
+
end
|
211
212
|
|
212
213
|
class NewTestStuff < TestStuff
|
213
214
|
has_boolean :foo
|
@@ -219,6 +220,8 @@ describe SimpleModel do
|
|
219
220
|
end
|
220
221
|
it "should merge defined attributes when class are inhereted" do
|
221
222
|
TestStuff.new.respond_to?(:bar_will_change!).should be_true
|
223
|
+
t = OtherStuff.new
|
224
|
+
t.bar = [1,2,4]
|
222
225
|
NewTestStuff.new.respond_to?(:bar_will_change!).should be_true
|
223
226
|
NewTestStuff.new.respond_to?(:foo_will_change!).should be_true
|
224
227
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 3.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 3.0.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: activemodel
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 3.0.1
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 3.0.1
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,22 +75,6 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: debugger
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
78
|
description: Simpifies building tableless models or models backed by webservices.
|
95
79
|
Create data type specific attributes with default if values.
|
96
80
|
email:
|
@@ -101,10 +85,14 @@ extra_rdoc_files: []
|
|
101
85
|
files:
|
102
86
|
- .gitignore
|
103
87
|
- .rspec
|
88
|
+
- .travis.yml
|
104
89
|
- Gemfile
|
105
90
|
- LICENSE.txt
|
106
91
|
- README.md
|
107
92
|
- Rakefile
|
93
|
+
- gemfiles/3.0.gemfile
|
94
|
+
- gemfiles/3.1.gemfile
|
95
|
+
- gemfiles/3.2.gemfile
|
108
96
|
- lib/simple_model.rb
|
109
97
|
- lib/simple_model/attributes.rb
|
110
98
|
- lib/simple_model/base.rb
|