relaton-nist 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 93987ca6ac6f597f394c317a843b423635418eefe9e1e0512d972382cf15bd78
4
- data.tar.gz: ee7c447e8292f0fd9fa21b0e436f348c044400b69e3116d05bb66405f66b092c
3
+ metadata.gz: 2ab3d1123704cbe701f2f8158ee2d60be05a762141a8c10f2d9f196f8b905dab
4
+ data.tar.gz: f06320c0918cf4d5b6354015e370b2cc7bab93247bfd842875086005de9ca247
5
5
  SHA512:
6
- metadata.gz: ed9f2703b8a68262f1b476c5111a93d160ba53ae2e065778e9ab71308a99503be6ec50096ba1653f267f314ac281d8be286b2f9784c59a2c9022478990e0f199
7
- data.tar.gz: decbc81d52f7edcfa06db0028e2d5152fe75199e2d2510d7bab7df3e766da98d61e735ced81e4e6a827404806bd16e402d395de501c8a14eb362038b3e8fba46
6
+ metadata.gz: 6a1bb823322716ac5115428bedbcad2cee3667bc24b8f7fc02030856f5028b92377196eaa8b4c1c6afe6cd67357af4a9d34d4fe7d09b8313e3310f6cc02394b8
7
+ data.tar.gz: 4fddf90e843ed03dc7d2dc281674a5ecf0ce69d58509682a36f39044dcfb7a769378153f194872f2199c1c8b702a6ca3c88be6f618d22a28283814ead733c37c
data/.travis.yml CHANGED
@@ -8,12 +8,10 @@ os:
8
8
  rvm:
9
9
  - 2.5
10
10
  - 2.4
11
- - 2.3
12
11
  - ruby-head
13
12
  before_install:
14
13
  - gem install bundler -v 2.0.1
15
14
  - bundle update
16
15
  matrix:
17
16
  allow_failures:
18
- - rvm: 2.3
19
17
  - rvm: ruby-head
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-nist (0.2.0)
4
+ relaton-nist (0.2.1)
5
5
  relaton-bib (~> 0.2.0)
6
6
 
7
7
  GEM
@@ -15,9 +15,9 @@ GEM
15
15
  safe_yaml (~> 1.0.0)
16
16
  debase (0.2.2)
17
17
  debase-ruby_core_source (>= 0.10.2)
18
- debase-ruby_core_source (0.10.4)
18
+ debase-ruby_core_source (0.10.5)
19
19
  diff-lcs (1.3)
20
- docile (1.3.1)
20
+ docile (1.3.2)
21
21
  equivalent-xml (0.6.0)
22
22
  nokogiri (>= 1.4.3)
23
23
  hashdiff (0.4.0)
@@ -34,23 +34,23 @@ GEM
34
34
  pry (~> 0.10)
35
35
  public_suffix (3.1.0)
36
36
  rake (10.5.0)
37
- relaton-bib (0.2.0)
37
+ relaton-bib (0.2.1)
38
38
  addressable
39
39
  nokogiri (~> 1.8.4)
40
40
  rspec (3.8.0)
41
41
  rspec-core (~> 3.8.0)
42
42
  rspec-expectations (~> 3.8.0)
43
43
  rspec-mocks (~> 3.8.0)
44
- rspec-core (3.8.0)
44
+ rspec-core (3.8.1)
45
45
  rspec-support (~> 3.8.0)
46
- rspec-expectations (3.8.3)
46
+ rspec-expectations (3.8.4)
47
47
  diff-lcs (>= 1.2.0, < 2.0)
48
48
  rspec-support (~> 3.8.0)
49
- rspec-mocks (3.8.0)
49
+ rspec-mocks (3.8.1)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
51
  rspec-support (~> 3.8.0)
52
- rspec-support (3.8.0)
53
- ruby-debug-ide (0.6.1)
52
+ rspec-support (3.8.2)
53
+ ruby-debug-ide (0.7.0)
54
54
  rake (>= 0.8.1)
55
55
  safe_yaml (1.0.5)
56
56
  simplecov (0.16.1)
@@ -59,10 +59,10 @@ GEM
59
59
  simplecov-html (~> 0.10.0)
60
60
  simplecov-html (0.10.2)
61
61
  vcr (5.0.0)
62
- webmock (3.5.1)
62
+ webmock (3.6.0)
63
63
  addressable (>= 2.3.6)
64
64
  crack (>= 0.3.2)
65
- hashdiff
65
+ hashdiff (>= 0.4.0, < 2.0.0)
66
66
 
67
67
  PLATFORMS
68
68
  ruby
@@ -43,11 +43,21 @@ module RelatonNist
43
43
 
44
44
  # @return [Iteger]
45
45
  def sort_value
46
- case hit[:status]
47
- when "final" then 1
48
- when "withdrawn" then 2
49
- when "draft (withdrawn)" then 3
50
- else 4
46
+ @sort_value ||= begin
47
+ sort_phrase = [hit[:serie], hit[:code], hit[:title]].join " "
48
+ corr = hit_collection.text.split.map do |w|
49
+ if w =~ /\w+/ &&
50
+ sort_phrase =~ Regexp.new(Regexp.escape(w), Regexp::IGNORECASE)
51
+ 1
52
+ else 0
53
+ end
54
+ end.sum
55
+ corr + case hit[:status]
56
+ when "final" then 3
57
+ when "withdrawn" then 2
58
+ when "draft (withdrawn)" then 1
59
+ else 0
60
+ end
51
61
  end
52
62
  end
53
63
  end
@@ -59,7 +59,14 @@ module RelatonNist
59
59
  }, self
60
60
  )
61
61
  end
62
- concat(hits.sort { |a, b| a.sort_value - b.sort_value })
62
+ hits.sort! do |a, b|
63
+ if a.sort_value != b.sort_value
64
+ b.sort_value - a.sort_value
65
+ else
66
+ (b.hit[:release_date] - a.hit[:release_date]).to_i
67
+ end
68
+ end
69
+ concat hits
63
70
  # concat(hits.map { |h| Hit.new(h, self) })
64
71
  @fetched = false
65
72
  # @hit_pages = hit_pages
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-15 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  version: '0'
231
231
  requirements: []
232
232
  rubyforge_project:
233
- rubygems_version: 2.7.6
233
+ rubygems_version: 2.7.7
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: 'RelatonNist: retrive NIST standards.'