frenchy 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/frenchy/model.rb +10 -0
- data/lib/frenchy/version.rb +1 -1
- data/spec/lib/frenchy/model_spec.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b87c18d424750ac80d153e0dfc11fae1a27d835
|
4
|
+
data.tar.gz: dfef868e271f1346e30e1b38e9a3083f04aa1e67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f32f3a1a9f63ffc28225bfe482992f061ed74a1707fd06b6ccd36fef052650907f406fa6d081e9ed0d7c257286295f23fd73e81f1ff403e83cf7b7a884c07111
|
7
|
+
data.tar.gz: f6628b1bd1b7e1994fa1bbd012db4e2cb491b9b12a4a8bd97e3f23c8230af13dca3ddb310c7733d580b83fdf5744ee8181fb383780dce1bf1b81f6d40b54b696
|
data/lib/frenchy/model.rb
CHANGED
@@ -26,6 +26,16 @@ module Frenchy
|
|
26
26
|
Hash[self.class.fields.map {|k,_| [k, send(k)]}]
|
27
27
|
end
|
28
28
|
|
29
|
+
# Returns a copy of the model
|
30
|
+
def to_model
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns that the model is persisted
|
35
|
+
def persisted?
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
29
39
|
# Return a string representing the value of the model instance
|
30
40
|
def inspect
|
31
41
|
"<#{self.class.name} #{attributes.map {|k,v| "#{k}: #{v.inspect}"}.join(", ")}>"
|
data/lib/frenchy/version.rb
CHANGED
@@ -65,6 +65,20 @@ describe Frenchy::Model do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
describe "#to_model" do
|
69
|
+
it "returns itself" do
|
70
|
+
model = SimpleModel.new(id: 1)
|
71
|
+
expect(model.to_model).to eq(model)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#persisted?" do
|
76
|
+
it "returns true" do
|
77
|
+
model = SimpleModel.new(id: 1)
|
78
|
+
expect(model.persisted?).to eq(true)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
68
82
|
describe "#decorate" do
|
69
83
|
it "decorates the model using the named convention" do
|
70
84
|
model = SimpleModel.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frenchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Coene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.2.
|
182
|
+
rubygems_version: 2.2.2
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Opinionated JSON API modeling framework for Ruby.
|