bogo 0.2.8 → 0.2.10

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: 7ec29a67728ffbbaf47b982278ada80c261d31dc
4
- data.tar.gz: 4e4fdefbbf834b13f81d1376abe7bb313cc650ed
3
+ metadata.gz: 4147a55ee937c7f32176f7401c9450fae36c3a34
4
+ data.tar.gz: fb706011f35266dfd5ad9c84d55d046a0a655db2
5
5
  SHA512:
6
- metadata.gz: c5bbed35f2489b6eff54bb7705ea0415b3de11ff3f7579671834ce010128e8aebf5032a193677f803855f5c144c044ff28fbf83675d677267d4d45e9af30402a
7
- data.tar.gz: 0b7530c5d0f21a58c14e22266604f3df71ea34c3414c968ef1a4c8adfc365677a627763e5cf9c0327ab33076f6377bfc59f652878b19cfa28343afea29f6920f
6
+ metadata.gz: 31a9b4dad739a3bb2650e9bec4b66c3e064ae09b13ad5b5ee9c3cf147da04acdc7a7c17a327e0b014ea148e4a5ca1b863b9e6bc3f0b00607abd6e697a28fcab0
7
+ data.tar.gz: 6a90ab84ac9a68e8f0c78d23d0951564a0277ddd69282ae32604c5299cdb2f0bc2d67bbb6f51242f7ba8ffc67cb936ee400a3d5b5979196371bd88cb21a2304e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # v0.2.10
2
+ * [Lazy] Dup and freeze non-dirty values
3
+
1
4
  # v0.2.8
2
5
  * [Smash] Support block default values via Smash#fetch
3
6
 
data/lib/bogo/lazy.rb CHANGED
@@ -136,10 +136,24 @@ module Bogo
136
136
  self.class.on_missing(self) unless data.has_key?(name) || dirty.has_key?(name)
137
137
  if(dirty.has_key?(name))
138
138
  dirty[name]
139
- elsif(data.has_key?(name))
140
- data[name]
141
139
  else
142
- self.class.attributes[name][:default]
140
+ if(data.has_key?(name))
141
+ val = data[name]
142
+ else
143
+ val = self.class.attributes[name][:default]
144
+ end
145
+ if(val.respond_to?(:dup))
146
+ begin
147
+ val = val.dup
148
+ rescue
149
+ val
150
+ end
151
+ end
152
+ if(val.respond_to?(:freeze))
153
+ val.freeze
154
+ else
155
+ val
156
+ end
143
157
  end
144
158
  end
145
159
  define_method("#{name}=") do |val|
data/lib/bogo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bogo
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.2.8')
3
+ VERSION = Gem::Version.new('0.2.10')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2017-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie