sipp 0.1.7 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 950a78c54189d24a5d4a9159c2c83d74647b867b
4
- data.tar.gz: 3a25d2e6be0a30821d1473db85ae7b31048cd2af
2
+ SHA256:
3
+ metadata.gz: 9b784f915b2c0017b3d19bf32422d016347800df9f0a35263da09a3ff22f3c1b
4
+ data.tar.gz: 89a1c0aaeef4a61937741945a2d8158accbdc60d49c56c12cfc929937aa30c9a
5
5
  SHA512:
6
- metadata.gz: a12870aa3d1ee2edba06d09015d08a9b708ab23c61cbafc62293f253f8a4217f87af052b2a41aeb3ff415fe126237364e08580bdd01a67c0037ae4ec48c965f4
7
- data.tar.gz: 87a73c7cd626016cb6e473584d3ca2c0ad04e564089c785b79d7cf58064b46fa5252eaf59051eab50931aacac4fc24179d448968ce5c820dcb4f6036dea02adb
6
+ metadata.gz: 5b74a7bc1ff32cf0d89a7e46537a7c3d1be88a79cccbc4adbf9ff7c5d282420843e0e2aa16f650ee7fff4430e0392f8300120af3c1f4c95e258bcee5ddb98e73
7
+ data.tar.gz: 0ccd26d12d91e3be60c49683ca7b69e864728d19ca2899ab650a7572fabbc19b0b2fc9ec32b84cf24c5a25aa8fe5cd3f4137461d0e1ba7f5ba6a5035208df531
data/Gemfile CHANGED
@@ -5,5 +5,3 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in sipp.gemspec
6
6
  gemspec
7
7
 
8
- gem 'i18n'
9
-
data/README.md CHANGED
@@ -115,22 +115,23 @@ Generates an Extended-SIPP code from capabilities provided and translates capabi
115
115
 
116
116
  Should be tried and discussed.
117
117
 
118
+ Generating an e-sipp code from capabilities:
118
119
  ```ruby
119
- SIPP::Extended.new('CCMFDA55').as_json
120
-
121
- {
120
+ SIPP::Extended.generate({
122
121
  category: :compact,
123
- type: :two_four_door,
122
+ type: :two_three_door,
124
123
  transmission: :manual,
125
124
  drive: :front,
126
- fuel: :diesel,
125
+ fuel: :petrol,
127
126
  ac: :air,
128
- doors: 5,
129
- seats: 5,
130
- bags_big: :unspecified,
131
- bags_small: :unspecified,
132
- }
133
-
127
+ doors: 2,
128
+ seats: 2,
129
+ bags_big: 3,
130
+ bags_small: 4,
131
+ }) # => 'CBMFPA2234'
132
+ ```
133
+ And capabilities from a code, just like a usual SIPP:
134
+ ```ruby
134
135
  SIPP::Extended.new('CBMFPN2234').as_json
135
136
  {
136
137
  category: :compact,
@@ -144,7 +145,23 @@ SIPP::Extended.new('CBMFPN2234').as_json
144
145
  bags_big: 3,
145
146
  bags_small: 4,
146
147
  }
148
+ ```
147
149
 
150
+ Puts `:unspecified` if cannot decode a capability:
151
+ ```ruby
152
+ SIPP::Extended.new('CCMFDA55').as_json
153
+ {
154
+ category: :compact,
155
+ type: :two_four_door,
156
+ transmission: :manual,
157
+ drive: :front,
158
+ fuel: :diesel,
159
+ ac: :air,
160
+ doors: 5,
161
+ seats: 5,
162
+ bags_big: :unspecified,
163
+ bags_small: :unspecified,
164
+ }
148
165
  ```
149
166
 
150
167
  ## TODO
data/lib/sipp/extended.rb CHANGED
@@ -5,6 +5,11 @@ module SIPP
5
5
  include ExtendedDictionary
6
6
 
7
7
  def self.generate(capabilities)
8
+ capabilities = capabilities.inject({}) do |caps, (k, v)|
9
+ val = v.respond_to?(:to_sym) ? v.to_sym : v
10
+ caps[k&.to_sym] = val
11
+ caps
12
+ end
8
13
  category = CATEGORY[capabilities[:category]]
9
14
  type = TYPE[capabilities[:type]]
10
15
  transmission = TRANSMISSION[capabilities[:transmission]]
@@ -23,21 +23,21 @@ module SIPP
23
23
  front: 'F',
24
24
  rear: 'R',
25
25
  all: 'A', # AWD
26
- fwd: 'X', # 4x4
26
+ fwd: 'X', # 4x4
27
27
  }.merge(WILDCARDS)
28
28
 
29
29
  # Fuel type. Mostly compatible with SIPP but you know... Made more human-guessable
30
30
  FUEL = {
31
- compressed_gas: "G",
32
- diesel: "D",
33
- electric: "E",
34
- electric_plus: "C",
35
- ethanol: "U",
36
- hybrid: "H",
37
- hybrid_plug_in: "I",
38
- hydrogen: "A",
39
- multi_fuel: "M",
40
- petrol: "P",
31
+ compressed_gas: 'G',
32
+ diesel: 'D',
33
+ electric: 'E',
34
+ electric_plus: 'C',
35
+ ethanol: 'U',
36
+ hybrid: 'H',
37
+ hybrid_plug_in: 'I',
38
+ hydrogen: 'A',
39
+ multi_fuel: 'M',
40
+ petrol: 'P',
41
41
  }.merge(WILDCARDS)
42
42
 
43
43
  # Most probably is subject to change in the future
@@ -46,8 +46,8 @@ module SIPP
46
46
  multi_zone: 'M',
47
47
  present: 'A',
48
48
  absent: 'N',
49
- false => 'N',
50
- true => 'A',
49
+ false => 'N',
50
+ true => 'A',
51
51
  air: 'A',
52
52
  no_air: 'N',
53
53
  }.merge(WILDCARDS)
@@ -5,33 +5,39 @@ module SIPP
5
5
  TYPE = SIPP::Code::TYPE.invert
6
6
 
7
7
  TRANSMISSION_DRIVE = {
8
- [:manual, :unspecified] => "M",
9
- [:manual, :four_wd] => "N",
10
- [:manual, :awd] => "C",
11
- [:auto, :unspecified] => "A",
12
- [:auto, :four_wd] => "B",
13
- [:auto, :awd] => "D"
8
+ [:manual, :unspecified] => 'M',
9
+ [:manual, :single] => 'M',
10
+ [:manual, :front] => 'M',
11
+ [:manual, :rear] => 'M',
12
+ [:manual, :four_wd] => 'N',
13
+ [:manual, :awd] => 'C',
14
+ [:auto, :unspecified] => 'A',
15
+ [:auto, :single] => 'A',
16
+ [:auto, :front] => 'A',
17
+ [:auto, :rear] => 'A',
18
+ [:auto, :four_wd] => 'B',
19
+ [:auto, :awd] => 'D'
14
20
  }
15
21
 
16
22
  FUEL_AC = {
17
- [:unspecified, :air] => "R",
18
- [:unspecified, :no_air] => "N",
19
- [:diesel, :air] => "D",
20
- [:diesel, :no_air] => "Q",
21
- [:hybrid, :air] => "H",
22
- [:hybrid_plug_in, :air] => "I",
23
- [:electric, :air] => "E",
24
- [:electric_plus, :air] => "C",
25
- [:compressed_gas, :air] => "L",
26
- [:compressed_gas, :no_air] => "S",
27
- [:hydrogen, :air] => "A",
28
- [:hydrogen, :no_air] => "B",
29
- [:multi_fuel, :air] => "M",
30
- [:multi_fuel, :no_air] => "F",
31
- [:petrol, :air] => "V",
32
- [:petrol, :no_air] => "Z",
33
- [:ethanol, :air] => "U",
34
- [:ethanol, :no_air] => "X",
23
+ [:unspecified, :air] => 'R',
24
+ [:unspecified, :no_air] => 'N',
25
+ [:diesel, :air] => 'D',
26
+ [:diesel, :no_air] => 'Q',
27
+ [:hybrid, :air] => 'H',
28
+ [:hybrid_plug_in, :air] => 'I',
29
+ [:electric, :air] => 'E',
30
+ [:electric_plus, :air] => 'C',
31
+ [:compressed_gas, :air] => 'L',
32
+ [:compressed_gas, :no_air] => 'S',
33
+ [:hydrogen, :air] => 'A',
34
+ [:hydrogen, :no_air] => 'B',
35
+ [:multi_fuel, :air] => 'M',
36
+ [:multi_fuel, :no_air] => 'F',
37
+ [:petrol, :air] => 'V',
38
+ [:petrol, :no_air] => 'Z',
39
+ [:ethanol, :air] => 'U',
40
+ [:ethanol, :no_air] => 'X',
35
41
  }
36
42
  end
37
43
  end
data/lib/sipp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SIPP
2
- VERSION = "0.1.7"
2
+ VERSION = '0.1.9'
3
3
  end
data/sipp.gemspec CHANGED
@@ -1,32 +1,32 @@
1
1
 
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "sipp/version"
4
+ require 'sipp/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "sipp"
7
+ spec.name = 'sipp'
8
8
  spec.version = SIPP::VERSION
9
- spec.authors = ["Max Buslaev"]
10
- spec.email = ["max@buslaev.net"]
9
+ spec.authors = ['Max Buslaev']
10
+ spec.email = ['max@buslaev.net']
11
11
 
12
12
  spec.summary = %q{SIPP aka ACRISS code dictionary}
13
- spec.description = %q{Translates car SIPP codes into something meaningful}
14
- spec.homepage = "https://github.com/austerlitz/sipp"
15
- spec.license = "MIT"
13
+ spec.description = %q{Translates car SIPP/ACRISS codes into something meaningful}
14
+ spec.homepage = 'https://github.com/austerlitz/sipp'
15
+ spec.license = 'MIT'
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
19
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
21
  end
22
- spec.bindir = "exe"
22
+ spec.bindir = 'exe'
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
24
+ spec.require_paths = ['lib']
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.17"
27
- spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "rspec", "~> 3.0"
29
- spec.add_development_dependency "pry"
26
+ spec.add_development_dependency 'bundler', '~> 1.17'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'pry'
30
30
 
31
- spec.add_dependency "i18n"
31
+ spec.add_dependency 'i18n'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sipp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-18 00:00:00.000000000 Z
11
+ date: 2023-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: Translates car SIPP codes into something meaningful
83
+ description: Translates car SIPP/ACRISS codes into something meaningful
84
84
  email:
85
85
  - max@buslaev.net
86
86
  executables: []
@@ -129,8 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.5.2
132
+ rubygems_version: 3.0.3
134
133
  signing_key:
135
134
  specification_version: 4
136
135
  summary: SIPP aka ACRISS code dictionary