hamsterdam 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/hamsterdam/clj.rb +10 -0
- data/lib/hamsterdam/version.rb +1 -1
- data/spec/hamsterdam_spec.rb +8 -8
- metadata +33 -51
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 46ac44d756fe02074bd23fcd6e58cbb741a062e2
|
4
|
+
data.tar.gz: a6a9636649b347d1c715dc8fb60a49b1b93a6e3b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8418a7690e341ae3c377aa83a5c3e5d452c27957c6000fa4cf2159293f27f55b3ede0b9371d3c5fc1194ca8c2b0a686d66f8edc6af09b984a82da4fa503a3610
|
7
|
+
data.tar.gz: 2c4ef6e353c68a4cbc33814a3b3baaf773b75c94a437ea52fde53ea691dfeb9b60e865356c95ca06c9ddb49dec47b5f929c16ea37d3b9d1614f6bd174dae7893
|
data/lib/hamsterdam/clj.rb
CHANGED
@@ -7,6 +7,16 @@ module Hamsterdam
|
|
7
7
|
Set = Java::ClojureLang::PersistentHashSet
|
8
8
|
Queue = Java::ClojureLang::PersistentQueue
|
9
9
|
|
10
|
+
#
|
11
|
+
# As of Java 8, PersistentHashMap#merge throws ArgumentError: wrong number of arguments (1 for 3).
|
12
|
+
# Converting away Clojure map via #to_hash, then merging, then re-Clojuring it seems to bypass this issue.
|
13
|
+
#
|
14
|
+
class Hash
|
15
|
+
def merge(a)
|
16
|
+
Hamsterdam.hash(to_hash.merge(a))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
10
20
|
def self.hash(h = nil)
|
11
21
|
if h.nil?
|
12
22
|
Hash::EMPTY
|
data/lib/hamsterdam/version.rb
CHANGED
data/spec/hamsterdam_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe "Hamsterdam structures" do
|
|
33
33
|
it "provides a set populated with passed values" do
|
34
34
|
s = Hamsterdam.set("a", "b", "c", "a")
|
35
35
|
s.should_not be_empty
|
36
|
-
s.
|
36
|
+
expect(s.size).to eq(3)
|
37
37
|
s.should include("a", "b", "c")
|
38
38
|
end
|
39
39
|
end
|
@@ -47,7 +47,7 @@ describe "Hamsterdam structures" do
|
|
47
47
|
it "provides a list populated with passed values" do
|
48
48
|
l = Hamsterdam.list("a", "b", "c", "a")
|
49
49
|
l.should_not be_empty
|
50
|
-
l.
|
50
|
+
expect(l.size).to eq(4)
|
51
51
|
l.should include("a", "b", "c")
|
52
52
|
l.to_a.should == ["a", "b", "c", "a"]
|
53
53
|
end
|
@@ -62,7 +62,7 @@ describe "Hamsterdam structures" do
|
|
62
62
|
it "provides a queue populated with passed values" do
|
63
63
|
q = Hamsterdam.queue("a", "b", "c", "d")
|
64
64
|
q.should_not be_empty
|
65
|
-
q.should
|
65
|
+
q.size.should eq(4)
|
66
66
|
q.peek.should == "a"
|
67
67
|
q.dequeue.to_a.should == ["b", "c", "d"]
|
68
68
|
end
|
@@ -107,7 +107,7 @@ describe "Hamsterdam structures" do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it "raises helpful error when constructed with invalid objects" do
|
110
|
-
lambda do struct_class.new("LAWDY") end.should raise_error
|
110
|
+
lambda do struct_class.new("LAWDY") end.should raise_error(/Do not want.*LAWDY/)
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "inheritance-based definition" do
|
@@ -168,15 +168,15 @@ describe "Hamsterdam structures" do
|
|
168
168
|
|
169
169
|
it "can be compared to nil" do
|
170
170
|
s1 = struct_class.new(top: 50, bottom: 75)
|
171
|
-
s1.eql?(nil).should
|
172
|
-
(s1 == nil).should
|
171
|
+
s1.eql?(nil).should be false
|
172
|
+
(s1 == nil).should be false
|
173
173
|
s1.should_not == nil
|
174
174
|
end
|
175
175
|
|
176
176
|
it "can be compared to non structs" do
|
177
177
|
s1 = struct_class.new(top: 50, bottom: 75)
|
178
|
-
s1.eql?(:foo).should
|
179
|
-
(s1 == :foo).should
|
178
|
+
s1.eql?(:foo).should be false
|
179
|
+
(s1 == :foo).should be false
|
180
180
|
s1.should_not == :foo
|
181
181
|
end
|
182
182
|
end
|
metadata
CHANGED
@@ -1,95 +1,84 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamsterdam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.11
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Crosby
|
9
8
|
- Patrick Bacon
|
10
|
-
autorequire:
|
9
|
+
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: hamster
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
16
|
requirements:
|
20
|
-
- -
|
17
|
+
- - '>='
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '0'
|
23
|
-
|
20
|
+
name: hamster
|
24
21
|
prerelease: false
|
22
|
+
type: :runtime
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '0'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
|
-
name: rake
|
33
29
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
30
|
requirements:
|
36
|
-
- -
|
31
|
+
- - '>='
|
37
32
|
- !ruby/object:Gem::Version
|
38
33
|
version: '0'
|
39
|
-
|
34
|
+
name: rake
|
40
35
|
prerelease: false
|
36
|
+
type: :development
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
44
|
requirements:
|
52
|
-
- -
|
45
|
+
- - '>='
|
53
46
|
- !ruby/object:Gem::Version
|
54
47
|
version: '0'
|
55
|
-
|
48
|
+
name: rspec
|
56
49
|
prerelease: false
|
50
|
+
type: :development
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- -
|
53
|
+
- - '>='
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: '0'
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
|
-
name: simplecov
|
65
57
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
58
|
requirements:
|
68
|
-
- -
|
59
|
+
- - '>='
|
69
60
|
- !ruby/object:Gem::Version
|
70
61
|
version: '0'
|
71
|
-
|
62
|
+
name: simplecov
|
72
63
|
prerelease: false
|
64
|
+
type: :development
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
|
-
name: pry
|
81
71
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
72
|
requirements:
|
84
|
-
- -
|
73
|
+
- - '>='
|
85
74
|
- !ruby/object:Gem::Version
|
86
75
|
version: '0'
|
87
|
-
|
76
|
+
name: pry
|
88
77
|
prerelease: false
|
78
|
+
type: :development
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
description: Immutable Struct-like record structures based on Hamster.
|
@@ -100,44 +89,37 @@ executables: []
|
|
100
89
|
extensions: []
|
101
90
|
extra_rdoc_files: []
|
102
91
|
files:
|
103
|
-
- README.md
|
104
92
|
- CHANGELOG
|
93
|
+
- README.md
|
94
|
+
- lib/hamsterdam.rb
|
105
95
|
- lib/hamsterdam/clj.rb
|
106
96
|
- lib/hamsterdam/version.rb
|
107
|
-
- lib/hamsterdam.rb
|
108
97
|
- spec/collections_spec.rb
|
109
98
|
- spec/hamsterdam_spec.rb
|
110
99
|
- spec/spec_helper.rb
|
111
100
|
- spec/support/hamsterdam_helpers.rb
|
112
101
|
homepage: https://github.com/atomicobject/hamsterdam
|
113
102
|
licenses: []
|
114
|
-
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
115
105
|
rdoc_options: []
|
116
106
|
require_paths:
|
117
107
|
- lib
|
118
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
109
|
requirements:
|
121
|
-
- -
|
110
|
+
- - '>='
|
122
111
|
- !ruby/object:Gem::Version
|
123
112
|
version: '0'
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
hash: -1856113987643234250
|
127
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
114
|
requirements:
|
130
|
-
- -
|
115
|
+
- - '>='
|
131
116
|
- !ruby/object:Gem::Version
|
132
117
|
version: '0'
|
133
|
-
segments:
|
134
|
-
- 0
|
135
|
-
hash: -1856113987643234250
|
136
118
|
requirements: []
|
137
|
-
rubyforge_project:
|
138
|
-
rubygems_version:
|
139
|
-
signing_key:
|
140
|
-
specification_version:
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.4.5
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
141
123
|
summary: Immutable Struct-like record structures based on Hamster.
|
142
124
|
test_files:
|
143
125
|
- spec/collections_spec.rb
|