hash_dot 2.0.3 → 2.1.0

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: c3b7b16cb12b7532c526d7d2b8c40c86d5eb1dd4
4
- data.tar.gz: 9c1d9e081cd58f95857a4a54afd71629882861db
3
+ metadata.gz: 448ec5a8658964de35063d5e4f34e7861af5a54d
4
+ data.tar.gz: a8152f865eff089a49741467ac14735277f96c00
5
5
  SHA512:
6
- metadata.gz: 9c11482797e83f68fa6a5744c0107c54a211cc05be8f2b16904802ebdfe1ed0e0892f483f86796b2e7249ae2e8cc93c5ade5d8338db8d37674d85f71b5de07c5
7
- data.tar.gz: c43f690063572e9fbacc2bdbca857f8476a2c83cafde22190c95200fe58e1d733e9a972f07bed77c7e8e41a82ffbf96a64b21482d6cbb4b4b1dea1664b997e39
6
+ metadata.gz: f7e57678d5d330b4948c731d500aa0ac91437836fe6f4e94c82e07401804cb41431099e4029946743a4bdc32ea54c55b51c0d3d4125d500e567680fa1176b08a
7
+ data.tar.gz: b7975158555229cf1a00525c2ff15c2c6dad1eea7ffc4c8113e9812c5dc1d086a787e5d0a70e0a0ceaabce3a4fd612130231cc10c01156d7dca36ff09b482ce4
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # HashDot
2
2
 
3
- HashDot allows you to call your Ruby hash properties with a dot syntax.
3
+ HashDot allows you to get and set your Ruby hash properties with a dot syntax.
4
4
 
5
5
  ```ruby
6
6
  require 'hash_dot'
@@ -12,6 +12,11 @@ HashDot allows you to call your Ruby hash properties with a dot syntax.
12
12
  user.job.title #=> 'Senior Programmer'
13
13
  user.job.delete(:title)
14
14
  user.job.title #=> NoMethodError
15
+ user.job.title = 'Engineer'
16
+ user.job.title #=> 'Engineer'
17
+ user.job.department = 'DevOps'
18
+ user.job.department #=> 'DevOps'
19
+ user #=> {:name=>'Anna', :job=>{:title=>'Engineer', :department=>'DevOps'}}
15
20
  ```
16
21
 
17
22
  You can also allow dot syntax for all hashes via the class setting.
data/lib/hash.rb CHANGED
@@ -16,11 +16,10 @@ class Hash
16
16
 
17
17
  prop = create_prop(method)
18
18
 
19
- super(method, args) && return unless key?(prop)
20
-
21
19
  if setter?(method)
22
20
  self[prop] = args.first
23
21
  else
22
+ super(method, args) && return unless key?(prop)
24
23
  self[prop]
25
24
  end
26
25
  end
@@ -1,3 +1,3 @@
1
1
  module HashDot
2
- VERSION = "2.0.3".freeze
2
+ VERSION = "2.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Steel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.5.1
143
+ rubygems_version: 2.6.8
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Use dot syntax with Ruby hashes.