adamantium 0.0.10 → 0.0.11

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
  SHA1:
3
- metadata.gz: 88dae963478a72fe7589b08e88a81184179035be
4
- data.tar.gz: 390175ab3f6de1d7a9410977a50c8601ea269f90
3
+ metadata.gz: 4b0049e404dd0b6bead1b53497d23c5fb32ffc51
4
+ data.tar.gz: 3945219defdbbda61deaa701742d312329a6fd55
5
5
  SHA512:
6
- metadata.gz: 13be4278552ccd06271dff3e7d9be93d2e21eb4cc58d4d89aedf9e2d91c19baf95120503909e98502c8911bdf2d9a8f1bfb4fb2f12d8dcb2ee5430c0cff8e36b
7
- data.tar.gz: a0162b86ddc7a6ad67b48307a7fea8804b4c50a7003497d724e618bcb236eac802df326563b3b01346c009173f3665bb0110739adec93941a3a78afbb7fc0e23
6
+ metadata.gz: 452f5edf8c0a14edb3df5b85b9dc9510a7b22215be98359f131a579eb4436e96e4c6ad1512cbe9fe828becc635b339713e53dd9380d7822b7c5c6e60badee790
7
+ data.tar.gz: e3914061c61c9fc2cf29750a741e8c993a8492dafec7f41e127b29173e735ad0fc148e4acbc4a394fc2f27ab4976860500532fc13fdf1664e9448da972c045d1
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 7
3
- total_score: 53
3
+ total_score: 56
@@ -164,3 +164,4 @@ end # module Adamantium
164
164
  require 'adamantium/module_methods'
165
165
  require 'adamantium/class_methods'
166
166
  require 'adamantium/freezer'
167
+ require 'adamantium/mutable'
@@ -0,0 +1,53 @@
1
+ module Adamantium
2
+
3
+ # Module fake frozen object
4
+ #
5
+ # This behavior sometimes is needed when a mutable
6
+ # object needs to be referenced in an inmutable object tree.
7
+ #
8
+ # If you have to use `memoize :foo, :freezer => :noop` to often you might
9
+ # want to include this module into your class.
10
+ #
11
+ # Use wisely! A rule of thumb only a tiny fraction of your objects
12
+ # typically deserves this.
13
+ #
14
+ module Mutable
15
+
16
+ # Noop freezer
17
+ #
18
+ # @example
19
+ # class DoesNotGetFrozen
20
+ # include Adamantium::Mutable
21
+ # end
22
+ #
23
+ # instance = DoesNotGetFrozen
24
+ # instance.freeze # => instance
25
+ #
26
+ # @return [self]
27
+ #
28
+ # @api public
29
+ #
30
+ def freeze
31
+ self
32
+ end
33
+
34
+ # Test if object is frozen
35
+ #
36
+ # @example
37
+ # class DoesNotGetFrozen
38
+ # include Adamantium::Mutable
39
+ # end
40
+ #
41
+ # instance = DoesNotGetFrozen
42
+ # instance.frozen? # => true
43
+ #
44
+ # @return [true]
45
+ #
46
+ # @api public
47
+ #
48
+ def frozen?
49
+ true
50
+ end
51
+
52
+ end # Mutable
53
+ end # Adamantium
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Adamantium
4
4
 
5
- # Released gem version
6
- VERSION = '0.0.10'.freeze
5
+ # Gem version
6
+ VERSION = '0.0.11'.freeze
7
7
 
8
8
  end # module Adamantium
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Adamantium::Mutable, '#freeze' do
4
+ subject { object.freeze }
5
+
6
+ let(:object) { class_under_test.new }
7
+
8
+ let(:class_under_test) do
9
+ Class.new do
10
+ include Adamantium::Mutable
11
+ end
12
+ end
13
+
14
+ it_should_behave_like 'a command method'
15
+
16
+ it 'keeps object mutable' do
17
+ subject
18
+ object.instance_variable_set(:@foo, :bar)
19
+ end
20
+ end
21
+
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Adamantium::Mutable, '#frozen?' do
4
+ subject { object.frozen? }
5
+
6
+ let(:object) { class_under_test.new }
7
+
8
+ let(:class_under_test) do
9
+ Class.new do
10
+ include Adamantium::Mutable
11
+ end
12
+ end
13
+
14
+ it { should be(true) }
15
+
16
+ it_should_behave_like 'an idempotent method'
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adamantium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Kubb
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-03 00:00:00.000000000 Z
12
+ date: 2013-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ice_nine
@@ -79,6 +79,7 @@ files:
79
79
  - lib/adamantium/class_methods.rb
80
80
  - lib/adamantium/freezer.rb
81
81
  - lib/adamantium/module_methods.rb
82
+ - lib/adamantium/mutable.rb
82
83
  - lib/adamantium/version.rb
83
84
  - spec/integration/adamantium_spec.rb
84
85
  - spec/rcov.opts
@@ -104,6 +105,8 @@ files:
104
105
  - spec/unit/adamantium/module_methods/memoize_spec.rb
105
106
  - spec/unit/adamantium/module_methods/memoized_predicate_spec.rb
106
107
  - spec/unit/adamantium/module_methods/original_instance_method_spec.rb
108
+ - spec/unit/adamantium/mutable/freeze_spec.rb
109
+ - spec/unit/adamantium/mutable/frozen_predicate_spec.rb
107
110
  homepage: https://github.com/dkubb/adamantium
108
111
  licenses: []
109
112
  metadata: {}
@@ -149,4 +152,6 @@ test_files:
149
152
  - spec/unit/adamantium/module_methods/memoize_spec.rb
150
153
  - spec/unit/adamantium/module_methods/memoized_predicate_spec.rb
151
154
  - spec/unit/adamantium/module_methods/original_instance_method_spec.rb
155
+ - spec/unit/adamantium/mutable/freeze_spec.rb
156
+ - spec/unit/adamantium/mutable/frozen_predicate_spec.rb
152
157
  has_rdoc: