ar_to_hash 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ef40f9728ce7159a68300e1bb9b014306d31c9a
4
- data.tar.gz: bcfcbd53b3042d531eb2d95312fd588ce75b5649
3
+ metadata.gz: 7f16466a2a020a9090438523dd93832694c6e64d
4
+ data.tar.gz: 080af9039367d04eb37f9a6d1056cbb4b9f410bd
5
5
  SHA512:
6
- metadata.gz: 1c30895beaaa55a5e1239098e4b58b08a790fd01cdf8a2def05013dc07bb72101cfb215d7c854109a99bc2e3fb040c50cb2f8c5407096c3a4aa5e3f9fe1fa9ae
7
- data.tar.gz: bc7fb4c7f0879a777774c3485cd7ae020ef61f729b0833180a2336165331b1a2e55328d0aaaa8cba46f698c2658c2bb26929cf5c658ca3cf7b9da36590bb7648
6
+ metadata.gz: f5325ce84d51745b1eb744180d1db19762c7541813e47bf9874e8279fab1ab25f6e2d36b8bbad7b8e00b78ec745c726656107ac7efc4c3a8dfde29e5849d6191
7
+ data.tar.gz: 9aeea9f1fbf99a793ae0d5cc58dbb733a50488edf705254c72129ce0ecea3a3fa67f749555190403d8372c813786c93608f56109b0b2f8b36e8065c284671ccb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ArToHash
2
2
 
3
- TODO: Write a gem description
3
+ Add `to_hash` method to ActiveRecord::Base.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,41 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ### Normal
22
+
23
+ ```rb
24
+ User.first.tapp
25
+ ----------
26
+ #<User:0x007f81d11e2760> {
27
+ :id => 1,
28
+ :created_at => Mon, 03 Feb 2014 15:21:37 JST +09:00,
29
+ :updated_at => Thu, 01 May 2014 16:02:39 JST +09:00,
30
+ }
31
+ ----------
32
+
33
+ User.first.class.name
34
+ ----------
35
+ => "User"
36
+ ----------
37
+ ```
38
+
39
+ ### to_hash
40
+
41
+ ```rb
42
+ User.first.to_hash.tapp
43
+ ----------
44
+ {
45
+ "id" => 1,
46
+ "created_at" => "2014-02-03T15:21:37.442+09:00",
47
+ "updated_at" => "2014-05-01T16:02:39.670+09:00",
48
+ }
49
+ ----------
50
+
51
+ User.first.to_hash.class.name
52
+ ----------
53
+ => "Hash"
54
+ ----------
55
+ ```
22
56
 
23
57
  ## Contributing
24
58
 
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  class Base
3
3
  def to_hash
4
- ActiveSupport::JSON.decode(self.to_json)
4
+ ActiveSupport::JSON.decode(self.to_json).symbolize_keys
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module ArToHash
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_to_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - shu0115
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler