strong_hash 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edf23f58a0327573ba32ef7ac454486f2e67efa92969a4664d233219cdf146bc
4
- data.tar.gz: 6faff202b407cfc7751d819b39fb2d9acbf14f28afa18668cce152703a459bc4
3
+ metadata.gz: 0edad334738b3234e83015c9191e8de63b14e155b54a04c74c97908ec998009b
4
+ data.tar.gz: 107ee7d232da6818253475d51f923de779c2975be7e4e76c91410f4bf1af5d98
5
5
  SHA512:
6
- metadata.gz: 59d483b20a4a123738d55ef71b1c5c60b557071c811a135b5190c3252a6d87a0fa505b1185d3c60adf686ac7d0491093abe57909233563d2d5f4ad9f8cac0920
7
- data.tar.gz: 66611fea215c2415e504fb3555deeb15bfbf280358c7690f758738bcafebfc6a486b70fd4e1c465671c6445dd503ab0696c6b83d61be3d5769dd1baf0917219d
6
+ metadata.gz: 67d5800384acf94f7a76d17357db3e3bdd71e27d1289fca4c82a532784a98793a42dbc17db5290912fc0c7b49505f464f47b552ecc8f8c1d1b785299f56d288d
7
+ data.tar.gz: 45e7a7d649b609dac73310a0d0dcecb61132d4ad66c7b9b45655b2e954f028fb353ac238f6c21403b2cc77eeae68b3b74c657ce4818e0233d0e1521d5799ed7a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strong_hash (0.1.1)
4
+ strong_hash (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # StrongHash
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/strong_hash`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
2
+ Let's you access Hash by dot operator. Just like calling a method on an object
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -21,8 +17,23 @@ Or install it yourself as:
21
17
  $ gem install strong_hash
22
18
 
23
19
  ## Usage
20
+ ```ruby
21
+ require 'strong_hash'
24
22
 
25
- TODO: Write usage instructions here
23
+ hash = {
24
+ name: 'Yask',
25
+ age: 23,
26
+ twitter: {
27
+ username: 'yask123'
28
+ }
29
+ }
30
+
31
+ StrongHash.new(hash).name
32
+ > Yask
33
+
34
+ StrongHash.new(hash).twitter.username
35
+ > yask123
36
+ ```
26
37
 
27
38
  ## Development
28
39
 
@@ -32,7 +43,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
43
 
33
44
  ## Contributing
34
45
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/strong_hash.
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[yask123]/strong_hash.
36
47
 
37
48
  ## License
38
49
 
data/lib/strong_hash.rb CHANGED
@@ -4,6 +4,11 @@ require 'active_support/core_ext/hash/indifferent_access'
4
4
  # by calling dot operator with key name
5
5
  module StrongHash
6
6
  def self.new(hash)
7
+ hash = hash.dup
8
+ hash.each do |key, val|
9
+ next unless val.is_a?(Hash)
10
+ hash[key] = new(val)
11
+ end
7
12
  StrongHashFactory.new(hash)
8
13
  end
9
14
 
@@ -1,3 +1,3 @@
1
1
  module StrongHash
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yask Srivastava
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-28 00:00:00.000000000 Z
11
+ date: 2018-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler