conformist 0.2.3 → 0.2.4

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: 8fe51dfa6a9ee750fa491c34c8348aad61de12c4
4
- data.tar.gz: b4cfe4f2d38a8087c50a7af1cfece66fd24f5cbc
3
+ metadata.gz: c7d066dfeac09134316436b908aae6722cc6f605
4
+ data.tar.gz: b3e9cfd42875b40279b380fc88558cf54636af67
5
5
  SHA512:
6
- metadata.gz: 556539d85a56a282b67e302e39ec24f019ab7dd1c984da14231e6a670f7244bfda044cbb3e2487d938114cd64d02de7cc5f6ab3d14b4060900f2ffa318d3871a
7
- data.tar.gz: 87bafbf9bc6df970a5d5e9c46aec70173a4198e6e2e660de1def9a5924a9d51327d6303ee7bd158d53f4de093022c587edc2c66dd592d5be8a77c827f572d1ed
6
+ metadata.gz: a4612f7cad313a5d199b34e12ecb0a1191eaa296463d251fd9258ea941e501edcc8476d2f78a82da98e778f15470120d47d88346bf2529835c4f5bf37fbe22be
7
+ data.tar.gz: 8e53fb246d2beb4eb1f138c5aafd04b7e36cc9f30194c83cfa94babbc9b6fbc42494108dd94d15a52a9c18aa0110c1e62455be50a1705a25eb747c2babc5351c
@@ -4,4 +4,8 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.0
6
6
  - 2.2.0
7
+ - 2.3.1
7
8
  - jruby
9
+
10
+ before_install:
11
+ - gem install bundler -v ">= 1.8.9"
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.4 / 2016-10-14
4
+
5
+ * Speed up processing large amounts of columns (@splattael)
6
+ * Official support for Ruby 2.3.1 (@splattael)
7
+
3
8
  ## 0.2.3 / 2015-03-04
4
9
 
5
10
  * Always return nil when named column isn't found. (@rywall)
data/README.md CHANGED
@@ -346,7 +346,7 @@ See CHANGELOG.md for a full list of changes.
346
346
 
347
347
  ## Compatibility
348
348
 
349
- * MRI 2.2.0, 2.1.0, 2.0.0, 1.9.3
349
+ * MRI 2.3.1, 2.2.0, 2.1.0, 2.0.0, 1.9.3
350
350
  * JRuby
351
351
 
352
352
  ## Dependencies
@@ -373,4 +373,4 @@ Motivation for this project came from the desire to simplify importing data from
373
373
 
374
374
  ## Copyright
375
375
 
376
- Copyright © 2011 Tate Johnson. Conformist is released under the MIT license. See LICENSE for details.
376
+ Copyright © 2016 Tate Johnson. Conformist is released under the MIT license. See LICENSE for details.
@@ -2,9 +2,10 @@ module Conformist
2
2
  class Builder
3
3
  def self.call schema, enumerable
4
4
  columns = schema.columns
5
- columns.inject HashStruct.new do |hash, column|
6
- hash.merge column.name => column.values_in(enumerable)
5
+ hash = columns.each_with_object({}) do |column, hash|
6
+ hash[column.name] = column.values_in(enumerable)
7
7
  end
8
+ HashStruct.new hash
8
9
  end
9
10
  end
10
11
  end
@@ -10,7 +10,7 @@ module Conformist
10
10
  end
11
11
 
12
12
  def calculate_indices!(headers)
13
- headers = Array(headers).collect {|header| header.to_s.downcase }
13
+ headers = Array(headers).collect {|header| header.to_s.downcase.squeeze(' ').strip }
14
14
 
15
15
  self.indexes = sources.collect do |source|
16
16
  if source.is_a?(String)
@@ -10,12 +10,6 @@ module Conformist
10
10
  self.attributes = attributes
11
11
  end
12
12
 
13
- def merge other
14
- self.class.new.tap do |instance|
15
- instance.attributes = attributes.merge other
16
- end
17
- end
18
-
19
13
  def == other
20
14
  other.class == self.class && attributes == other.attributes
21
15
  end
@@ -1,3 +1,3 @@
1
1
  module Conformist
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -41,12 +41,9 @@ class Conformist::ColumnTest < Minitest::Test
41
41
  end
42
42
 
43
43
  def test_array
44
- mock = Minitest::Mock.new
45
- mock.expect :to_a, ['a']
46
44
  column = Column.new :foo, 0
47
45
  assert_equal 'a', column.values_in(['a'])
48
46
  assert_equal 'a', column.values_in('a')
49
- assert_equal 'a', column.values_in(mock)
50
47
  end
51
48
 
52
49
  def test_nil
@@ -24,14 +24,6 @@ class Conformist::HashStructTest < Minitest::Test
24
24
  refute_equal hash1, hash3
25
25
  end
26
26
 
27
- def test_merge
28
- hash1 = HashStruct.new
29
- hash2 = hash1.merge :a => 1
30
- refute_equal hash1.object_id, hash2.object_id
31
- refute_equal 1, hash1[:a]
32
- assert_equal 1, hash2[:a]
33
- end
34
-
35
27
  def test_readers_with_method_missing
36
28
  hash = HashStruct.new :a => 1, :c_d => 1
37
29
  assert_equal 1, hash.a
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conformist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tate Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project: conformist
123
- rubygems_version: 2.2.2
123
+ rubygems_version: 2.5.1
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Bend CSVs to your will with declarative schemas.