multimatrix 0.5 → 0.6

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: d8f6393e3e1c459791655a6c6f30bd0a7f78b0d0
4
- data.tar.gz: 6f5ffd1a3193c167d4588b3a7a9eab6969f39873
3
+ metadata.gz: 8fb8ccc3d287e3b36e384bc84fa8192a10234df9
4
+ data.tar.gz: 60891a78a4c6ecc73a7194bad36e3e90cf5496e7
5
5
  SHA512:
6
- metadata.gz: b57ebdd5ffb85a48c0dc60794048694ed5d66ee5d1d56dc69f87d31beb54856180516d2ca327e71e0be66159b9837b7d899e6977e186cf8201d1addf7c57945b
7
- data.tar.gz: 72ef66d0c904fb7a2c7ea1cff9497c7a4a79fd8714e4199a7493e7a3fbdbb6cee1f2904c4d1e8c5e0bf6056469daa010a554be7f89fe8d410c0b41d53dd5b867
6
+ metadata.gz: c177bd75d9d841203015a70577a8ba20101ee238aa42e0bf38d63af81affde8d1d9d4d6259d85e567265378702cf308376ed00e242943c1c4f5fb8e8cdd0ce66
7
+ data.tar.gz: b161024a28384548863e8c5f7302459885b19ade5a3b9b3bfba4139490935a570cbb64fdb3223b9556c0799533616510daba8cf9e0783b56a5b3cee0e43381b9
@@ -78,7 +78,7 @@ class MultiMatrix
78
78
  # use labels appropriate for Hash keys, because they will be stored as such internally.
79
79
  # labels could be Symbols, Integers, even ActiveModel objects, the only requirement for it that it have to
80
80
  # have a meaningful == method.
81
- # @param labels an [Array] of values to be used as dimension labels
81
+ # @param labelskeys an [Array] of values to be used as dimension labels
82
82
  def initialize(*labelskeys)
83
83
  raise MultiMatrixException, "no dimensions" if labelskeys.length == 0
84
84
  @labels = labelskeys
@@ -189,7 +189,7 @@ class MultiMatrix
189
189
  tmp = MultiMatrix.new(*(@labels - labels.keys.find_all {|val| labels[val].class != Array}))
190
190
  ids = find_ids(labels)
191
191
  ids.each do |id|
192
- hash = @labels_by_id[id]
192
+ hash = @labels_by_id[id].clone
193
193
  labels.keys.find_all {|val| labels[val].class != Array}.each do |key|
194
194
  hash.delete(key)
195
195
  end
@@ -139,4 +139,17 @@ class MultiMatrixTest < Test::Unit::TestCase
139
139
  assert_equal x[:x => 1],y
140
140
  end
141
141
 
142
+ def test_labels_disappearence_bug
143
+
144
+ x = MultiMatrix.new(:x, :y, :z)
145
+ x[:x => 1, :y => 1, :z => 1] = 1
146
+ x[:x => 2, :y => 1, :z => 1] = 1
147
+
148
+ assert_equal [1,2], x.values_for_label(:x)
149
+
150
+ assert_equal 2, x.sum()
151
+ x[{:x => 1}]
152
+ assert_equal [1,2], x.values_for_label(:x)
153
+
154
+ end
142
155
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multimatrix
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gergely Dömsödi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An n-dim matrix data structure with fast loop, search and access
14
14
  email: doome@uhusystems.com