ruby_px 0.4.0 → 0.5.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
- SHA1:
3
- metadata.gz: 1de65efec0cbab985769ee3cc643c6c7b1e90196
4
- data.tar.gz: ea27a5bc542d42c54e7947373177e7ce09a32966
2
+ SHA256:
3
+ metadata.gz: 01235f74e28d6d1186e62da5c6707ddac25e6f50778b6e0c6e7e7a73ceeecf36
4
+ data.tar.gz: 960319e79d1b648e652f1fa5d485384e100155a20f6cc97a12565687dbcbc4f4
5
5
  SHA512:
6
- metadata.gz: a72e451829655ecaa985b8f85f56b5c154a7a37c95d6e6a7add13b60bbf3f4a2ab3cf69d0ce4f2db595568db74b4f4604d712e5f380e9c96f231a992081a9946
7
- data.tar.gz: 6a74e5337db838e84b2d6c3be0fd3c74372efbae95b790414694118bf35d0d82ab90d7182f7d24686b63496bf92fe60822ee5db169a9bbe068dc597db70e1385
6
+ metadata.gz: e559e8c337c98de95d64d49ad15873f48dec23dda11c63082f9f03b901db1357397bb4d4e1f82b0e804cf2bc42869823941de97c4525338b5f7b21aa4eb85433
7
+ data.tar.gz: 9db728337171b243da96e49a0c4f7a4852494a1743154637e98321698a31ee72765d2477be6b7774829cecb9a5fd82508366668878fda94686b7ef107956f886
data/README.md CHANGED
@@ -82,7 +82,6 @@ dataset.data('edad (año a año)' => 'Total', 'sexo' => 'Ambos sexos')
82
82
 
83
83
  ## TODO
84
84
 
85
- - Allow to receive an URL as an argument
86
85
  - Refactor
87
86
  - Test the gem with more files
88
87
  - Speed-up the parsing time
@@ -1,3 +1,5 @@
1
+ require "open-uri"
2
+
1
3
  module RubyPx
2
4
  class Dataset
3
5
  attr_reader :headings, :stubs
@@ -6,18 +8,14 @@ module RubyPx
6
8
  HEADING_RECORD = 'HEADING'
7
9
  STUB_RECORD = 'STUB'
8
10
 
9
- def initialize(file)
10
- if !File.readable?(file)
11
- raise "File #{file} not readable"
12
- end
13
-
11
+ def initialize(resource_uri)
14
12
  @metadata = {}
15
13
  @headings = []
16
14
  @stubs = []
17
15
  @values = {}
18
16
  @data = []
19
17
 
20
- parse_file(file)
18
+ parse_resource(resource_uri)
21
19
  end
22
20
 
23
21
  def title
@@ -103,15 +101,16 @@ module RubyPx
103
101
 
104
102
  private
105
103
 
106
- def parse_file(file)
107
- File.foreach(file) do |line|
104
+ def parse_resource(resource_uri)
105
+ open(resource_uri).each_line do |line|
108
106
  parse_line(line.chomp)
109
107
  end
110
- return true
108
+
109
+ true
111
110
  end
112
111
 
113
112
  def parse_line(line)
114
- @line = line
113
+ @line = line.force_encoding('utf-8').encode('utf-8')
115
114
 
116
115
  if @current_record.nil?
117
116
  key, value = line.scan(/[^\=]+/)
data/ruby_px.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "ruby_px"
7
- spec.version = '0.4.0'
7
+ spec.version = '0.5.0'
8
8
  spec.authors = ["Fernando Blat"]
9
9
  spec.email = ["ferblape@gmail.com"]
10
10
 
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_runtime_dependency "activesupport", ">= 4.2.5"
30
30
 
31
- spec.add_development_dependency "bundler", "~> 1.10"
32
- spec.add_development_dependency "rake", "~> 10.0"
33
- spec.add_development_dependency "rspec", "~> 3.4"
31
+ spec.add_development_dependency "bundler", "~> 2.0.1"
32
+ spec.add_development_dependency "rake", "~> 12.3"
33
+ spec.add_development_dependency "rspec", "~> 3.8"
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_px
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Blat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.10'
33
+ version: 2.0.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.10'
40
+ version: 2.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '12.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.4'
61
+ version: '3.8'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.4'
68
+ version: '3.8'
69
69
  description: Read PC-Axis files using Ruby
70
70
  email:
71
71
  - ferblape@gmail.com
@@ -106,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubyforge_project:
110
- rubygems_version: 2.5.1
109
+ rubygems_version: 3.0.2
111
110
  signing_key:
112
111
  specification_version: 4
113
112
  summary: Read PC-Axis files using Ruby