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 +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/conformist/builder.rb +3 -2
- data/lib/conformist/column.rb +1 -1
- data/lib/conformist/hash_struct.rb +0 -6
- data/lib/conformist/version.rb +1 -1
- data/test/unit/conformist/column_test.rb +0 -3
- data/test/unit/conformist/hash_struct_test.rb +0 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7d066dfeac09134316436b908aae6722cc6f605
|
4
|
+
data.tar.gz: b3e9cfd42875b40279b380fc88558cf54636af67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4612f7cad313a5d199b34e12ecb0a1191eaa296463d251fd9258ea941e501edcc8476d2f78a82da98e778f15470120d47d88346bf2529835c4f5bf37fbe22be
|
7
|
+
data.tar.gz: 8e53fb246d2beb4eb1f138c5aafd04b7e36cc9f30194c83cfa94babbc9b6fbc42494108dd94d15a52a9c18aa0110c1e62455be50a1705a25eb747c2babc5351c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
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 ©
|
376
|
+
Copyright © 2016 Tate Johnson. Conformist is released under the MIT license. See LICENSE for details.
|
data/lib/conformist/builder.rb
CHANGED
@@ -2,9 +2,10 @@ module Conformist
|
|
2
2
|
class Builder
|
3
3
|
def self.call schema, enumerable
|
4
4
|
columns = schema.columns
|
5
|
-
columns.
|
6
|
-
hash
|
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
|
data/lib/conformist/column.rb
CHANGED
@@ -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
|
data/lib/conformist/version.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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.
|