hamsterdam 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ Hamsterdam v1.0.12
2
+ * Updates to be compatible with Hamster 3.0 (doesn't work with older versions). No longer works with Ruby 1.9 due to a dependency of Hamster 3.0.
3
+
1
4
  Hamsterdam v1.0.5
2
5
  * Added hamsterdam/clj to allow for optionally using the Clojure PersistentHashMap isntead of a Hamster hash as the backing data structure
3
6
 
@@ -5,19 +5,19 @@ module Hamsterdam
5
5
  module Hamster
6
6
 
7
7
  def self.hash(*hash)
8
- ::Hamster.hash(*hash)
8
+ ::Hamster::Hash[*hash]
9
9
  end
10
10
 
11
11
  def self.set(*values)
12
- ::Hamster.set(*values)
12
+ ::Hamster::Set[*values]
13
13
  end
14
14
 
15
15
  def self.list(*values)
16
- ::Hamster.list(*values)
16
+ ::Hamster::List[*values]
17
17
  end
18
18
 
19
19
  def self.queue(*values)
20
- ::Hamster.queue(*values)
20
+ ::Hamster::Deque[*values]
21
21
  end
22
22
 
23
23
  def self.internal_hash_class
@@ -25,11 +25,13 @@ module Hamsterdam
25
25
  end
26
26
 
27
27
  def self.symbolize_keys(hash)
28
- hash.reduce(hash) do |memo,k,v|
29
- if Symbol === k
28
+ hash.entries.reduce(hash) do |memo, entry|
29
+ key = entry.first
30
+ value = entry.last
31
+ if Symbol === key
30
32
  memo
31
33
  else
32
- memo.delete(k).put(k.to_sym, v)
34
+ memo.delete(key).put(key.to_sym, value)
33
35
  end
34
36
  end
35
37
  end
@@ -203,4 +205,31 @@ module Hamsterdam
203
205
  end
204
206
  end
205
207
  end
208
+
209
+ module Hamster
210
+ class Hash
211
+ def inspect
212
+ to_hash.to_s.gsub(/=>/, " => ")
213
+ end
214
+ end
215
+
216
+ module List
217
+ def inspect
218
+ to_a.inspect
219
+ end
220
+ end
221
+
222
+ class Set
223
+ def inspect
224
+ to_a.inspect.sub(/^\[/, "{").sub(/\]$/, "}")
225
+ end
226
+ end
227
+
228
+ class Deque
229
+ def inspect
230
+ to_a.inspect
231
+ end
232
+ end
233
+ end
234
+
206
235
  Hamsterdam.internals = Hamsterdam::Hamster
@@ -7,16 +7,6 @@ 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
-
20
10
  def self.hash(h = nil)
21
11
  if h.nil?
22
12
  Hash::EMPTY
@@ -1,3 +1,3 @@
1
1
  module Hamsterdam
2
- VERSION = "1.0.11"
2
+ VERSION = "1.0.12"
3
3
  end
@@ -63,7 +63,7 @@ describe "Hamsterdam structures" do
63
63
  q = Hamsterdam.queue("a", "b", "c", "d")
64
64
  q.should_not be_empty
65
65
  q.size.should eq(4)
66
- q.peek.should == "a"
66
+ q.first.should == "a"
67
67
  q.dequeue.to_a.should == ["b", "c", "d"]
68
68
  end
69
69
  end
@@ -248,14 +248,14 @@ describe "Hamsterdam structures" do
248
248
  it "does a nice job with other Hamsterdam structs" do
249
249
  wheel1 = Hamstest::Wheel.new x: 50, y: 100, radius: 5.0, label: "front"
250
250
  wheel2 = Hamstest::Wheel.new x: 100, y: 100, radius: 5.0, label: "back"
251
- car = Hamstest::Vehicle.new wheels: Hamster.list(wheel1, wheel2), body_style: "sedan"
251
+ car = Hamstest::Vehicle.new wheels: Hamster::List[wheel1, wheel2], body_style: "sedan"
252
252
  expected = "<Vehicle wheels: [<Wheel x: 50 y: 100 radius: 5.0 label: \"front\">, <Wheel x: 100 y: 100 radius: 5.0 label: \"back\">] body_style: \"sedan\">"
253
253
  car.inspect.should == expected
254
254
  car.to_s.should == expected
255
255
  end
256
256
 
257
257
  it "does a nice job with Hamster Lists, Sets, and Hashes" do
258
- thinger = Hamstest::Thinger.new a_hash: Hamster.hash(red: "fish"), a_set: Hamster.set(42), a_list: Hamster.list(:oh, :the, :things)
258
+ thinger = Hamstest::Thinger.new a_hash: Hamster::Hash[red: "fish"], a_set: Hamster::Set[42], a_list: Hamster::List[:oh, :the, :things]
259
259
  expected = "<Thinger a_hash: {:red => \"fish\"} a_set: {42} a_list: [:oh, :the, :things]>"
260
260
  thinger.inspect.should == expected
261
261
  thinger.to_s.should == expected
@@ -3,6 +3,11 @@ PROJECT_ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
3
3
  $LOAD_PATH << "#{PROJECT_ROOT}/lib"
4
4
  $LOAD_PATH << "#{PROJECT_ROOT}/spec"
5
5
 
6
+ require 'rubygems'
7
+ require 'bundler/setup'
8
+ Bundler.require(:default)
9
+ Bundler.require(:test)
10
+
6
11
  require 'simplecov' # SimpleCov must come first!
7
12
  # This start/config code could alternatively go in .simplecov in project root:
8
13
  SimpleCov.start do
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamsterdam
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ prerelease:
5
+ version: 1.0.12
5
6
  platform: ruby
6
7
  authors:
7
8
  - David Crosby
@@ -9,78 +10,96 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-01-31 00:00:00.000000000 Z
13
+ date: 2016-03-12 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
16
+ name: hamster
17
+ version_requirements: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ none: false
15
23
  requirement: !ruby/object:Gem::Requirement
16
24
  requirements:
17
- - - '>='
25
+ - - ! '>='
18
26
  - !ruby/object:Gem::Version
19
- version: '0'
20
- name: hamster
27
+ version: '3.0'
28
+ none: false
21
29
  prerelease: false
22
30
  type: :runtime
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
23
33
  version_requirements: !ruby/object:Gem::Requirement
24
34
  requirements:
25
- - - '>='
35
+ - - ! '>='
26
36
  - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
37
+ version: !binary |-
38
+ MA==
39
+ none: false
29
40
  requirement: !ruby/object:Gem::Requirement
30
41
  requirements:
31
- - - '>='
42
+ - - ! '>='
32
43
  - !ruby/object:Gem::Version
33
- version: '0'
34
- name: rake
44
+ version: !binary |-
45
+ MA==
46
+ none: false
35
47
  prerelease: false
36
48
  type: :development
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - '>='
53
+ - - ! '>='
40
54
  - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
55
+ version: !binary |-
56
+ MA==
57
+ none: false
43
58
  requirement: !ruby/object:Gem::Requirement
44
59
  requirements:
45
- - - '>='
60
+ - - ! '>='
46
61
  - !ruby/object:Gem::Version
47
- version: '0'
48
- name: rspec
62
+ version: !binary |-
63
+ MA==
64
+ none: false
49
65
  prerelease: false
50
66
  type: :development
67
+ - !ruby/object:Gem::Dependency
68
+ name: simplecov
51
69
  version_requirements: !ruby/object:Gem::Requirement
52
70
  requirements:
53
- - - '>='
71
+ - - ! '>='
54
72
  - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
73
+ version: !binary |-
74
+ MA==
75
+ none: false
57
76
  requirement: !ruby/object:Gem::Requirement
58
77
  requirements:
59
- - - '>='
78
+ - - ! '>='
60
79
  - !ruby/object:Gem::Version
61
- version: '0'
62
- name: simplecov
80
+ version: !binary |-
81
+ MA==
82
+ none: false
63
83
  prerelease: false
64
84
  type: :development
85
+ - !ruby/object:Gem::Dependency
86
+ name: pry
65
87
  version_requirements: !ruby/object:Gem::Requirement
66
88
  requirements:
67
- - - '>='
89
+ - - ! '>='
68
90
  - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
91
+ version: !binary |-
92
+ MA==
93
+ none: false
71
94
  requirement: !ruby/object:Gem::Requirement
72
95
  requirements:
73
- - - '>='
96
+ - - ! '>='
74
97
  - !ruby/object:Gem::Version
75
- version: '0'
76
- name: pry
98
+ version: !binary |-
99
+ MA==
100
+ none: false
77
101
  prerelease: false
78
102
  type: :development
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - '>='
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
103
  description: Immutable Struct-like record structures based on Hamster.
85
104
  email:
86
105
  - david.crosby@atomicobject.com
@@ -89,40 +108,54 @@ executables: []
89
108
  extensions: []
90
109
  extra_rdoc_files: []
91
110
  files:
92
- - CHANGELOG
93
111
  - README.md
94
- - lib/hamsterdam.rb
95
- - lib/hamsterdam/clj.rb
96
- - lib/hamsterdam/version.rb
97
- - spec/collections_spec.rb
98
- - spec/hamsterdam_spec.rb
99
- - spec/spec_helper.rb
100
- - spec/support/hamsterdam_helpers.rb
112
+ - CHANGELOG
113
+ - !binary |-
114
+ bGliL2hhbXN0ZXJkYW0ucmI=
115
+ - !binary |-
116
+ bGliL2hhbXN0ZXJkYW0vY2xqLnJi
117
+ - !binary |-
118
+ bGliL2hhbXN0ZXJkYW0vdmVyc2lvbi5yYg==
119
+ - !binary |-
120
+ c3BlYy9jb2xsZWN0aW9uc19zcGVjLnJi
121
+ - !binary |-
122
+ c3BlYy9oYW1zdGVyZGFtX3NwZWMucmI=
123
+ - !binary |-
124
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
125
+ - !binary |-
126
+ c3BlYy9zdXBwb3J0L2hhbXN0ZXJkYW1faGVscGVycy5yYg==
101
127
  homepage: https://github.com/atomicobject/hamsterdam
102
128
  licenses: []
103
- metadata: {}
104
129
  post_install_message:
105
130
  rdoc_options: []
106
131
  require_paths:
107
132
  - lib
108
133
  required_ruby_version: !ruby/object:Gem::Requirement
109
134
  requirements:
110
- - - '>='
135
+ - - ! '>='
111
136
  - !ruby/object:Gem::Version
112
- version: '0'
137
+ version: !binary |-
138
+ MA==
139
+ none: false
113
140
  required_rubygems_version: !ruby/object:Gem::Requirement
114
141
  requirements:
115
- - - '>='
142
+ - - ! '>='
116
143
  - !ruby/object:Gem::Version
117
- version: '0'
144
+ version: !binary |-
145
+ MA==
146
+ none: false
118
147
  requirements: []
119
148
  rubyforge_project:
120
- rubygems_version: 2.4.5
149
+ rubygems_version: 1.8.24
121
150
  signing_key:
122
- specification_version: 4
151
+ specification_version: 3
123
152
  summary: Immutable Struct-like record structures based on Hamster.
124
153
  test_files:
125
- - spec/collections_spec.rb
126
- - spec/hamsterdam_spec.rb
127
- - spec/spec_helper.rb
128
- - spec/support/hamsterdam_helpers.rb
154
+ - !binary |-
155
+ c3BlYy9jb2xsZWN0aW9uc19zcGVjLnJi
156
+ - !binary |-
157
+ c3BlYy9oYW1zdGVyZGFtX3NwZWMucmI=
158
+ - !binary |-
159
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
160
+ - !binary |-
161
+ c3BlYy9zdXBwb3J0L2hhbXN0ZXJkYW1faGVscGVycy5yYg==
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 46ac44d756fe02074bd23fcd6e58cbb741a062e2
4
- data.tar.gz: a6a9636649b347d1c715dc8fb60a49b1b93a6e3b
5
- SHA512:
6
- metadata.gz: 8418a7690e341ae3c377aa83a5c3e5d452c27957c6000fa4cf2159293f27f55b3ede0b9371d3c5fc1194ca8c2b0a686d66f8edc6af09b984a82da4fa503a3610
7
- data.tar.gz: 2c4ef6e353c68a4cbc33814a3b3baaf773b75c94a437ea52fde53ea691dfeb9b60e865356c95ca06c9ddb49dec47b5f929c16ea37d3b9d1614f6bd174dae7893