tableschema 0.5.0 → 0.6.0

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: af9d2ac90e521ace72b172703da49b220a957978
4
- data.tar.gz: 95a2e84830de62dbe00e0b4a107222b60d48bdd4
3
+ metadata.gz: 4213e2bcb8976d39f68070432938713c4b3427c0
4
+ data.tar.gz: ffdc42291e4875bed97368c6c74ea63382733eff
5
5
  SHA512:
6
- metadata.gz: e9de112e6d3f5bc137fde4fd9e972ca2ff97a6b818e3a66e184bc3d0868c9e77e71221ad76bbad56a2014753a24bef71705607063b08a96afa730b6dbd4114d0
7
- data.tar.gz: 5caf4a5bde09a437ccf4d7a6cb91ae44fc07395366179ac682b6ba9b0a90dc966a5d5c51f2f80b70ae0911250aa5244e59b0b77e9df8821901929663807f631b
6
+ metadata.gz: 9f6af414cb6b284600fcbea95103a18d485a55def675507a289be49681f00b130463c7b896b57651ef24730511ee26caedb58ac14ebf0ded385270c5080a8c70
7
+ data.tar.gz: 5fb01a2169b7a6e616a19346c616fdb1f090e6010b5de2c61dbc504b97f192454f216a9e86b7b20d170385b91f767d349e655cbcd776b5ba649893765e96be3b
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # Table Schema
2
- formerly known as JSON Table Schema
1
+ # tableschema-rb
3
2
 
4
3
  [![Travis](https://travis-ci.org/frictionlessdata/tableschema-rb.svg?branch=master)](https://travis-ci.org/frictionlessdata/tableschema-rb)
5
4
  [![Coveralls](https://coveralls.io/repos/github/frictionlessdata/tableschema-rb/badge.svg?branch=master)](https://coveralls.io/github/frictionlessdata/tableschema-rb?branch=master)
@@ -46,11 +45,11 @@ The gem `jsontableschema` is no longer maintained. Here are the steps to transit
46
45
  2. Replace module name `JsonTableSchema` with module name `TableSchema`. For example:
47
46
 
48
47
  ```ruby
49
- JsonTableSchema::Table.new(source, schema)
48
+ JsonTableSchema::Table.new(source, schema: schema)
50
49
  ```
51
50
  with
52
51
  ```ruby
53
- TableSchema::Table.new(source, schema)
52
+ TableSchema::Table.new(source, schema: schema)
54
53
  ```
55
54
 
56
55
  ## Usage
@@ -75,9 +74,9 @@ schema = {
75
74
  ]
76
75
  }
77
76
 
78
- csv = 'https://github.com/frictionlessdata/tableschema-rb/raw/master/spec/fixtures/simple_data.csv'
77
+ source = 'https://github.com/frictionlessdata/tableschema-rb/raw/master/spec/fixtures/simple_data.csv'
79
78
 
80
- table = TableSchema::Table.new(csv, schema)
79
+ table = TableSchema::Table.new(source, schema: schema)
81
80
 
82
81
  # Iterate through rows
83
82
  table.iter{ |row| print row }
@@ -100,9 +99,9 @@ Both `iter` and `read` take the optional parameters:
100
99
  If you don't have a schema for a CSV, and want to generate one, you can infer a schema like so:
101
100
 
102
101
  ```ruby
103
- csv = 'https://github.com/frictionlessdata/tableschema-rb/raw/master/spec/fixtures/simple_data.csv' # Can also be a url or array of arrays
102
+ source = 'https://github.com/frictionlessdata/tableschema-rb/raw/master/spec/fixtures/simple_data.csv' # Can also be a url or array of arrays
104
103
 
105
- table = TableSchema::Table.new(csv, nil)
104
+ table = TableSchema::Table.new(source)
106
105
  table.infer()
107
106
  table.schema
108
107
  #=> {:fields=>[{:name=>"id", :title=>"", :description=>"", :type=>"integer", :format=>"default", :constraints=>{}}, {:name=>"title", :title=>"", :description=>"", :type=>"string", :format=>"default", :constraints=>{}}]}
@@ -5,12 +5,12 @@ module TableSchema
5
5
 
6
6
  attr_reader :headers, :schema
7
7
 
8
- def initialize(csv, descriptor, csv_options: {})
8
+ def initialize(source, schema: nil, csv_options: {})
9
9
  @csv_options = csv_options.merge(headers: true)
10
- @descriptor = descriptor
11
- @csv = parse_csv(csv)
10
+ @csv = parse_csv(source)
11
+ @descriptor = schema
12
12
  @headers = initialize_headers
13
- if !descriptor.nil?
13
+ if !@descriptor.nil?
14
14
  @schema = TableSchema::Schema.new(@descriptor)
15
15
  initialize_unique_colums
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module TableSchema
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.6.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tableschema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Open Knowledge Foundation
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler