avro_turf 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/avro_turf.rb +9 -4
- data/lib/avro_turf/core_ext.rb +7 -0
- data/lib/avro_turf/core_ext/date.rb +5 -0
- data/lib/avro_turf/core_ext/enumerable.rb +5 -0
- data/lib/avro_turf/core_ext/hash.rb +7 -0
- data/lib/avro_turf/core_ext/numeric.rb +5 -0
- data/lib/avro_turf/core_ext/string.rb +5 -0
- data/lib/avro_turf/core_ext/symbol.rb +5 -0
- data/lib/avro_turf/core_ext/time.rb +5 -0
- data/lib/avro_turf/version.rb +1 -1
- data/spec/core_ext/date_spec.rb +6 -0
- data/spec/core_ext/enumerable_spec.rb +12 -0
- data/spec/core_ext/hash_spec.rb +8 -0
- data/spec/core_ext/numeric_spec.rb +6 -0
- data/spec/core_ext/string_spec.rb +5 -0
- data/spec/core_ext/symbol_spec.rb +5 -0
- data/spec/core_ext/time_spec.rb +6 -0
- metadata +24 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6babda857fb94d0703569d4091d0431ca143728f
|
4
|
+
data.tar.gz: debd3b5581b00744308dc7bf3f531184dc94a895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26051349a7d90ee51a521099eaffa02c6cd2778d4be2a2832c3c4e8afd3892158eef68658d209ff06315d05ded7ebfecb7bdceaffae56a43077127c704c2f932
|
7
|
+
data.tar.gz: 305e8af7c8adc7483c86596109c5f3bbd807e95bbafb66439574c254637ac1b0e6fa59e4635b59dbb4c226744d0bf0abbade5f752d3d9df7a40eda78c946feeb
|
data/lib/avro_turf.rb
CHANGED
@@ -2,12 +2,20 @@ require 'avro_turf/version'
|
|
2
2
|
require 'avro'
|
3
3
|
require 'json'
|
4
4
|
require 'avro_turf/schema_store'
|
5
|
+
require 'avro_turf/core_ext'
|
5
6
|
|
6
7
|
class AvroTurf
|
7
8
|
class Error < StandardError; end
|
8
9
|
class SchemaError < Error; end
|
9
10
|
class SchemaNotFoundError < Error; end
|
10
11
|
|
12
|
+
# Create a new AvroTurf instance with the specified configuration.
|
13
|
+
#
|
14
|
+
# schemas_path - The String path to the root directory containing Avro schemas.
|
15
|
+
# namespace - The String namespace that should be used to qualify schema names (optional).
|
16
|
+
# codec - The String name of a codec that should be used to compress messages (optional).
|
17
|
+
#
|
18
|
+
# Currently, the only valid codec name is `deflate`.
|
11
19
|
def initialize(schemas_path:, namespace: nil, codec: nil)
|
12
20
|
@namespace = namespace
|
13
21
|
@schema_store = SchemaStore.new(path: schemas_path)
|
@@ -34,9 +42,6 @@ class AvroTurf
|
|
34
42
|
# data - The data that should be encoded.
|
35
43
|
# schema_name - The name of a schema in the `schemas_path`.
|
36
44
|
# stream - An IO object that the encoded data should be written to (optional).
|
37
|
-
# codec - The String name of a codec that should be used to compress messages (optional).
|
38
|
-
#
|
39
|
-
# Currently, the only valid codec name is `deflate`.
|
40
45
|
#
|
41
46
|
# Returns nothing.
|
42
47
|
def encode_to_stream(data, schema_name:, stream:, namespace: @namespace)
|
@@ -44,7 +49,7 @@ class AvroTurf
|
|
44
49
|
writer = Avro::IO::DatumWriter.new(schema)
|
45
50
|
|
46
51
|
dw = Avro::DataFile::Writer.new(stream, writer, schema, @codec)
|
47
|
-
dw << data
|
52
|
+
dw << data.as_avro
|
48
53
|
dw.close
|
49
54
|
end
|
50
55
|
|
data/lib/avro_turf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro_turf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -96,6 +96,14 @@ files:
|
|
96
96
|
- avro_turf.gemspec
|
97
97
|
- circle.yml
|
98
98
|
- lib/avro_turf.rb
|
99
|
+
- lib/avro_turf/core_ext.rb
|
100
|
+
- lib/avro_turf/core_ext/date.rb
|
101
|
+
- lib/avro_turf/core_ext/enumerable.rb
|
102
|
+
- lib/avro_turf/core_ext/hash.rb
|
103
|
+
- lib/avro_turf/core_ext/numeric.rb
|
104
|
+
- lib/avro_turf/core_ext/string.rb
|
105
|
+
- lib/avro_turf/core_ext/symbol.rb
|
106
|
+
- lib/avro_turf/core_ext/time.rb
|
99
107
|
- lib/avro_turf/schema_store.rb
|
100
108
|
- lib/avro_turf/version.rb
|
101
109
|
- perf/address.avsc
|
@@ -103,6 +111,13 @@ files:
|
|
103
111
|
- perf/encoding_speed.rb
|
104
112
|
- perf/person.avsc
|
105
113
|
- spec/avro_turf_spec.rb
|
114
|
+
- spec/core_ext/date_spec.rb
|
115
|
+
- spec/core_ext/enumerable_spec.rb
|
116
|
+
- spec/core_ext/hash_spec.rb
|
117
|
+
- spec/core_ext/numeric_spec.rb
|
118
|
+
- spec/core_ext/string_spec.rb
|
119
|
+
- spec/core_ext/symbol_spec.rb
|
120
|
+
- spec/core_ext/time_spec.rb
|
106
121
|
- spec/schema_store_spec.rb
|
107
122
|
- spec/spec_helper.rb
|
108
123
|
homepage: https://github.com/dasch/avro_turf
|
@@ -132,6 +147,13 @@ summary: A library that makes it easier to use the Avro serialization format fro
|
|
132
147
|
Ruby
|
133
148
|
test_files:
|
134
149
|
- spec/avro_turf_spec.rb
|
150
|
+
- spec/core_ext/date_spec.rb
|
151
|
+
- spec/core_ext/enumerable_spec.rb
|
152
|
+
- spec/core_ext/hash_spec.rb
|
153
|
+
- spec/core_ext/numeric_spec.rb
|
154
|
+
- spec/core_ext/string_spec.rb
|
155
|
+
- spec/core_ext/symbol_spec.rb
|
156
|
+
- spec/core_ext/time_spec.rb
|
135
157
|
- spec/schema_store_spec.rb
|
136
158
|
- spec/spec_helper.rb
|
137
159
|
has_rdoc:
|