hashme 0.2.4 → 0.2.5

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: 6f661ccdfd584ab3c1da7e2b5681a16d65063680
4
- data.tar.gz: c50294da6a1433fdf17b24896a4fc1c6eafe3cff
3
+ metadata.gz: a2c83753729924cb8ce0b33b18cae286f361d976
4
+ data.tar.gz: a9e0c44b939e0dca840d64fa1cdd91ad2850e517
5
5
  SHA512:
6
- metadata.gz: ac96d51a4764a70037e5b693fc27ebbb08463363ce0d626b7382efbdf0b9ab16e1af12cb94be200595a26fbac7fb272125741e0921876b20dca9954f27dd0b38
7
- data.tar.gz: 6104d65c1741d731405f492bafb59aeb4b57189b4d18096928b75272f91558dbb126304e01c27ba6dc5ffcd6e95f3fc5ab58680bc7be6986e0729e840c71741f
6
+ metadata.gz: 3648a068f2c367ef54172a04e49f3991bd042d087b1288bb99becf3fe2daa87f9f933f0bf1aa9d2a149fa3b8576ca2ab7727144590834dbeaad0743599f47f78
7
+ data.tar.gz: 8b05b8582dc6ebb5c4167901906eaa0abbbeb5021dbec4ca48fbaa1fb8a81b3852aa24e008c7102e715acefcbb24bf9d25b96479407f469a9e9b6aa0d30f2b79
data/README.md CHANGED
@@ -118,6 +118,10 @@ u.errors.first # [:email, "can't be blank"]
118
118
 
119
119
  ## History
120
120
 
121
+ ### 0.2.5 - 2016-06-03 - Again!
122
+
123
+ * Adding support for deleting attributes by setting them to nil to keep output clean.
124
+
121
125
  ### 0.2.4 - 2016-06-03
122
126
 
123
127
  * Removing `casted_by` property, due to lack of use case and complication it causes.
@@ -14,7 +14,12 @@ module Hashme
14
14
  def set_attribute(name, value)
15
15
  property = get_property(name)
16
16
  if property
17
- self[property.name] = property.build(self, value)
17
+ value = property.build(self, value)
18
+ if value.nil?
19
+ delete(property.name)
20
+ else
21
+ self[property.name] = value
22
+ end
18
23
  end
19
24
  end
20
25
 
@@ -1,3 +1,3 @@
1
1
  module Hashme
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -43,6 +43,14 @@ describe Hashme::Properties do
43
43
  obj.set_attribute(:name, name)
44
44
  expect(obj[:name]).to eql(name)
45
45
  end
46
+
47
+ it "should delete attribute set to nil" do
48
+ obj.name = "test"
49
+ expect(obj.name).to eql("test")
50
+ obj.name = nil
51
+ expect(obj.name).to be_nil
52
+ expect(obj.keys.map(&:to_s)).to_not include('name')
53
+ end
46
54
  end
47
55
 
48
56
  describe "#attribtues=" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Lown