adamantium 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile +17 -10
- data/README.md +22 -28
- data/TODO +1 -1
- data/adamantium.gemspec +2 -2
- data/lib/adamantium/freezer.rb +1 -1
- data/lib/adamantium/version.rb +1 -1
- data/spec/unit/adamantium/freezer/deep/class_methods/call_spec.rb +16 -0
- metadata +11 -12
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,10 +4,14 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
+
group :yard do
|
8
|
+
gem 'redcarpet', '~> 2.2.2', :platforms => [ :mri, :rbx ]
|
9
|
+
end
|
10
|
+
|
7
11
|
group :guard do
|
8
|
-
gem 'guard', '~> 1.
|
9
|
-
gem 'guard-bundler', '~> 0.
|
10
|
-
gem 'guard-rspec', '~>
|
12
|
+
gem 'guard', '~> 1.5.4'
|
13
|
+
gem 'guard-bundler', '~> 1.0.0'
|
14
|
+
gem 'guard-rspec', '~> 1.2.1'
|
11
15
|
end
|
12
16
|
|
13
17
|
group :benchmarks do
|
@@ -16,17 +20,16 @@ end
|
|
16
20
|
|
17
21
|
platform :jruby do
|
18
22
|
group :jruby do
|
19
|
-
gem 'jruby-openssl', '~> 0.
|
23
|
+
gem 'jruby-openssl', '~> 0.8.2'
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
23
27
|
group :metrics do
|
24
|
-
gem 'flay', '~> 1.4.
|
25
|
-
gem 'flog', '~> 2.5.
|
28
|
+
gem 'flay', '~> 1.4.3'
|
29
|
+
gem 'flog', '~> 2.5.3'
|
26
30
|
gem 'reek', '~> 1.2.8', :github => 'dkubb/reek'
|
27
31
|
gem 'roodi', '~> 2.1.0'
|
28
|
-
gem 'yardstick', '~> 0.
|
29
|
-
gem 'simplecov'
|
32
|
+
gem 'yardstick', '~> 0.8.0'
|
30
33
|
|
31
34
|
platforms :ruby_18, :ruby_19 do
|
32
35
|
# this indirectly depends on ffi which does not build on ruby-head
|
@@ -38,14 +41,18 @@ group :metrics do
|
|
38
41
|
gem 'fattr', '~> 2.2.0' # for metric_fu
|
39
42
|
gem 'heckle', '~> 1.4.3'
|
40
43
|
gem 'json', '~> 1.7.3' # for metric_fu rake task
|
41
|
-
gem 'map', '~> 6.0
|
44
|
+
gem 'map', '~> 6.2.0' # for metric_fu
|
42
45
|
gem 'metric_fu', '~> 2.1.1'
|
43
46
|
gem 'mspec', '~> 1.5.17'
|
44
47
|
gem 'rcov', '~> 1.0.0'
|
45
48
|
gem 'ruby2ruby', '= 1.2.2' # for heckle
|
46
49
|
end
|
47
50
|
|
51
|
+
platforms :ruby_19 do
|
52
|
+
gem 'simplecov', '~> 0.7.1'
|
53
|
+
end
|
54
|
+
|
48
55
|
platforms :rbx do
|
49
|
-
gem 'pelusa', '~> 0.2.
|
56
|
+
gem 'pelusa', '~> 0.2.2'
|
50
57
|
end
|
51
58
|
end
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
adamantium
|
2
2
|
==========
|
3
3
|
|
4
|
-
|
4
|
+
Create immutable objects
|
5
|
+
|
6
|
+
[![Build Status](https://secure.travis-ci.org/dkubb/adamantium.png)](https://travis-ci.org/dkubb/adamantium)
|
5
7
|
[![Dependency Status](https://gemnasium.com/dkubb/adamantium.png)](https://gemnasium.com/dkubb/adamantium)
|
6
8
|
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dkubb/adamantium)
|
7
9
|
|
@@ -11,12 +13,24 @@ It allows to make objects immutable in an unobtrusive way.
|
|
11
13
|
Installation
|
12
14
|
------------
|
13
15
|
|
14
|
-
|
16
|
+
With Rubygems:
|
15
17
|
|
16
|
-
|
18
|
+
```bash
|
19
|
+
$ gem install adamantium
|
20
|
+
$ irb -rubygems
|
21
|
+
>> require 'adamantium'
|
22
|
+
=> true
|
23
|
+
```
|
17
24
|
|
18
|
-
|
19
|
-
|
25
|
+
With git and local working copy:
|
26
|
+
|
27
|
+
```bash
|
28
|
+
$ git clone git://github.com/dkubb/adamantium.git
|
29
|
+
$ cd adamantium
|
30
|
+
$ rake install
|
31
|
+
$ irb -rubygems
|
32
|
+
>> require 'adamantium'
|
33
|
+
=> true
|
20
34
|
```
|
21
35
|
|
22
36
|
Examples
|
@@ -135,27 +149,7 @@ Contributing
|
|
135
149
|
* Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged.
|
136
150
|
* Send me a pull request. Bonus points for topic branches.
|
137
151
|
|
138
|
-
|
139
|
-
|
152
|
+
Copyright
|
153
|
+
---------
|
140
154
|
|
141
|
-
Copyright
|
142
|
-
Copyright (c) 2012 Markus Schirp
|
143
|
-
|
144
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
145
|
-
a copy of this software and associated documentation files (the
|
146
|
-
"Software"), to deal in the Software without restriction, including
|
147
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
148
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
149
|
-
permit persons to whom the Software is furnished to do so, subject to
|
150
|
-
the following conditions:
|
151
|
-
|
152
|
-
The above copyright notice and this permission notice shall be
|
153
|
-
included in all copies or substantial portions of the Software.
|
154
|
-
|
155
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
156
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
157
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
158
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
159
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
160
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
161
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
155
|
+
Copyright © 2012 Dan Kubb. See LICENSE for details.
|
data/TODO
CHANGED
@@ -1 +1 @@
|
|
1
|
-
*
|
1
|
+
* Update #hash to be memoized automatically
|
data/adamantium.gemspec
CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.extra_rdoc_files = %w[LICENSE README.md TODO]
|
18
18
|
|
19
19
|
gem.add_runtime_dependency('backports', '~> 2.6.4')
|
20
|
-
gem.add_runtime_dependency('ice_nine', '~> 0.
|
20
|
+
gem.add_runtime_dependency('ice_nine', '~> 0.6.0')
|
21
21
|
|
22
|
-
gem.add_development_dependency('rake', '~> 0.
|
22
|
+
gem.add_development_dependency('rake', '~> 10.0.3')
|
23
23
|
gem.add_development_dependency('rspec', '~> 1.3.2')
|
24
24
|
gem.add_development_dependency('yard', '~> 0.8.3')
|
25
25
|
end
|
data/lib/adamantium/freezer.rb
CHANGED
@@ -26,7 +26,7 @@ module Adamantium
|
|
26
26
|
# @api public
|
27
27
|
def self.call(object)
|
28
28
|
case object
|
29
|
-
when Numeric, TrueClass, FalseClass, NilClass, Symbol, Class, Module
|
29
|
+
when Numeric, TrueClass, FalseClass, NilClass, Symbol, Class, Module, UnboundMethod, Method
|
30
30
|
object
|
31
31
|
else
|
32
32
|
freeze_value(object)
|
data/lib/adamantium/version.rb
CHANGED
@@ -43,6 +43,22 @@ describe Adamantium::Freezer::Deep, '.call' do
|
|
43
43
|
it { should equal(value) }
|
44
44
|
end
|
45
45
|
|
46
|
+
context 'with a method value' do
|
47
|
+
let(:value) { Object.method(:to_s) }
|
48
|
+
|
49
|
+
it { should equal(value) }
|
50
|
+
|
51
|
+
it { should_not be_frozen }
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'with a unbound method value' do
|
55
|
+
let(:value) { Object.instance_method(:to_s) }
|
56
|
+
|
57
|
+
it { should equal(value) }
|
58
|
+
|
59
|
+
it { should_not be_frozen }
|
60
|
+
end
|
61
|
+
|
46
62
|
context 'with a module value' do
|
47
63
|
let(:value) { Module.new }
|
48
64
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adamantium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dan Kubb
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-12-20 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: backports
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 7
|
46
46
|
segments:
|
47
47
|
- 0
|
48
|
-
-
|
48
|
+
- 6
|
49
49
|
- 0
|
50
|
-
version: 0.
|
50
|
+
version: 0.6.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
@@ -58,13 +58,12 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 73
|
62
62
|
segments:
|
63
|
+
- 10
|
63
64
|
- 0
|
64
|
-
-
|
65
|
-
|
66
|
-
- 2
|
67
|
-
version: 0.9.2.2
|
65
|
+
- 3
|
66
|
+
version: 10.0.3
|
68
67
|
type: :development
|
69
68
|
version_requirements: *id003
|
70
69
|
- !ruby/object:Gem::Dependency
|