phantom-object 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +48 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07e4ae3b9fedae232900e5b08fac0b751855f644
4
- data.tar.gz: 5f978ded7968ca7bb8a33cf4cd7839f12cb7cd85
3
+ metadata.gz: 899e827016c6981c42fac70e59e5b65046b52a9a
4
+ data.tar.gz: 900ac7cf818d09056bf334723852c87c993aa2fa
5
5
  SHA512:
6
- metadata.gz: 138521d6fe1a1c689e7e1ea93b26e9e5fd3afaa7dad84061b379167cfc9d13f752815bd3df586dd4755b11a3cd371f6a13a5b95ad896f4f3836c26a93c3897f1
7
- data.tar.gz: 8a0840fec9a3154b8567c51b54724483cbb9ae2e71a01e38c5bed79bc082b8aef0f309599fcb20eb0336638c34e13b045bb76d9a98e876728469060ddd462ed0
6
+ metadata.gz: f8f1dcd39e49d401be9811ba2ffc72f7f2a661eb94b62fb5c472460e22cd91acb49c5571c2fa4a486dca6edcc7c6aece035786d4e907e05a3ced0c44a9fd9373
7
+ data.tar.gz: 5d1056855c41556b06f5c32a9e87bbe448170cb10e425fdc61c0c13c4c45f82cdd81b14dc2d07176393d0a2170ff1720d11dc7c1e97b7d240305ef7b14530224
data/README.rdoc CHANGED
@@ -1,5 +1,52 @@
1
1
  = A Hash to object converter
2
2
 
3
+ Allows you to convert complex Hashes into objects for more common use.
4
+
3
5
  In your Gemfile, make sure you have this gem:
4
6
 
5
- gem 'phantom-object'
7
+ gem 'phantom-object'
8
+
9
+ Now you can do this
10
+
11
+ h = {
12
+ key: "Some value",
13
+ another_key: "Another value"
14
+ }
15
+
16
+ o = PhantomObject.new(h)
17
+
18
+ p h.key
19
+ # => "Some value"
20
+ p h.another_key
21
+ # => "Some value"
22
+
23
+ And even this
24
+
25
+ h = {
26
+ nested: {
27
+ key: "Some value"
28
+ }
29
+ }
30
+
31
+ o = PhantomObject.new(h)
32
+
33
+ p h.nested.key
34
+ # => "Some value"
35
+
36
+ For any level, and with arrays
37
+
38
+ And also you can do this, instead of PhantomObject.new()
39
+
40
+ h = {
41
+ key: "Some value",
42
+ another_key: "Another value"
43
+ }
44
+
45
+ o = h.to_object
46
+
47
+ p h.key
48
+ # => "Some value"
49
+ p h.another_key
50
+ # => "Some value"
51
+
52
+ Also, PhantomObject includes ActiveModel, and you can extend it to use validations, form builders, etc.
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.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kourza Ivan a.k.a. Phobos98