phantom-object 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -0
- data/lib/phantom-object.rb +2 -11
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4d7811010ab1465fceb8635cb91032227f30235
|
|
4
|
+
data.tar.gz: 865a30ccee4423376493524be5456fd892817f9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 351426fad4e9339e1d8788c4bc3c3806171638ae9bbe5349023d2e1b95a01fbbe52a84ad0802247e7f743181efd74be4ffd11e3f51d49572fa875f5f9425a2bf
|
|
7
|
+
data.tar.gz: 0048141a9a58c61d8531652f9d56827b058ac352853e11f98520b07a684bc36dc40c996b2413fc7d27679879df272fae6f6ce970b14138488ecc0ed2689d886d
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
phantom-object (1.1.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: http://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
diff-lcs (1.2.4)
|
|
10
|
+
rspec (2.14.1)
|
|
11
|
+
rspec-core (~> 2.14.0)
|
|
12
|
+
rspec-expectations (~> 2.14.0)
|
|
13
|
+
rspec-mocks (~> 2.14.0)
|
|
14
|
+
rspec-core (2.14.5)
|
|
15
|
+
rspec-expectations (2.14.2)
|
|
16
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
17
|
+
rspec-mocks (2.14.3)
|
|
18
|
+
|
|
19
|
+
PLATFORMS
|
|
20
|
+
ruby
|
|
21
|
+
|
|
22
|
+
DEPENDENCIES
|
|
23
|
+
phantom-object!
|
|
24
|
+
rspec
|
data/lib/phantom-object.rb
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
require 'hash_converter'
|
|
2
2
|
class PhantomObject
|
|
3
3
|
|
|
4
|
-
include ActiveModel::Validations
|
|
5
|
-
include ActiveModel::Conversion
|
|
6
|
-
include ActiveModel::Serializers
|
|
7
|
-
extend ActiveModel::Naming
|
|
8
|
-
|
|
9
4
|
def initialize args = {}
|
|
10
5
|
assign_attributes args
|
|
11
6
|
end
|
|
@@ -13,8 +8,8 @@ class PhantomObject
|
|
|
13
8
|
def assign_attributes args = {}
|
|
14
9
|
args.each do |key, value|
|
|
15
10
|
raise ArgumentError, 'Your hash has keys with whitespaces' if key.match(/\s/i)
|
|
16
|
-
raise ArgumentError, 'Your hash has keys with Capital letters at the beginning' if key.match(/\A[A-Z]/
|
|
17
|
-
self.class_eval("attr_accessor :#{key}") unless self.respond_to?(key.to_sym)
|
|
11
|
+
raise ArgumentError, 'Your hash has keys with Capital letters at the beginning' if key.match(/\A[A-Z]/)
|
|
12
|
+
self.class.class_eval("attr_accessor :#{key}") unless self.respond_to?(key.to_sym)
|
|
18
13
|
if value.is_a?(Array)
|
|
19
14
|
self.send("#{key}=", value.map{ |v| self.class.new(v) })
|
|
20
15
|
elsif value.is_a?(Hash)
|
|
@@ -25,8 +20,4 @@ class PhantomObject
|
|
|
25
20
|
end
|
|
26
21
|
end
|
|
27
22
|
|
|
28
|
-
def persisted?
|
|
29
|
-
false
|
|
30
|
-
end
|
|
31
|
-
|
|
32
23
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phantom-object
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kourza Ivan a.k.a. Phobos98
|
|
@@ -9,7 +9,21 @@ autorequire: builder
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2013-08-30 00:00:00.000000000 Z
|
|
12
|
-
dependencies:
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
description: A Hash to object converter
|
|
14
28
|
email: phobos98@phobos98.net
|
|
15
29
|
executables: []
|
|
@@ -18,12 +32,14 @@ extra_rdoc_files:
|
|
|
18
32
|
- Gemfile
|
|
19
33
|
- Rakefile
|
|
20
34
|
- README.rdoc
|
|
35
|
+
- Gemfile.lock
|
|
21
36
|
files:
|
|
22
37
|
- lib/phantom-object.rb
|
|
23
38
|
- lib/hash_converter.rb
|
|
24
39
|
- Gemfile
|
|
25
40
|
- Rakefile
|
|
26
41
|
- README.rdoc
|
|
42
|
+
- Gemfile.lock
|
|
27
43
|
homepage: https://github.com/Phobos98/phantom-object
|
|
28
44
|
licenses: []
|
|
29
45
|
metadata: {}
|