vrt 0.4.5 → 0.4.6

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vrt.rb +11 -3
  3. data/lib/vrt/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e8fdb3b98ca2dc2a3d80a34195354bbd7addc48
4
- data.tar.gz: d3b5aa0103b7a0f9f5c3e3a7e494e39a96c29592
3
+ metadata.gz: 1c41b68638caaea9a439b88847fe6a9485012836
4
+ data.tar.gz: e387bc10e9e3e5279047cc5d3cb967b3efce069a
5
5
  SHA512:
6
- metadata.gz: '08f5fc1eceb70e117890a70c987dfcf3f050238ca89821fdee542829c7c078c3919fbead82218f21a31cca02215d0c1a8a2f773ea9c94bc1d8ddb075d44502bd'
7
- data.tar.gz: cbe653d4784aea7daabb1925b6cf461b40b0a753fb5f10f94a53e83ba84b96b4aab88aa552c86c0f0974c00a161975c036183cf96d46d8677b3d986a0e0a6ee0
6
+ metadata.gz: c8aa886633c62b9aca5c96236a99e3c7160fcf020f8e638ee1bff2c6e2c2c47ab30cb961a00fb2b08c169348800e776579aeb6546ec5e5588d3adf6d3dd91c9d
7
+ data.tar.gz: 2542205ee579f73fc429266119b44db8fd6d1b3c11858c0b1112c59c35b666899c025f01191a747505d0d134460d4135d36ffafd33b9383c68623458dfdc6802
data/lib/vrt.rb CHANGED
@@ -21,6 +21,7 @@ module VRT
21
21
 
22
22
  @version_json = {}
23
23
  @last_update = {}
24
+ @maps = {}
24
25
 
25
26
  module_function
26
27
 
@@ -52,7 +53,7 @@ module VRT
52
53
  end
53
54
 
54
55
  def current_categories
55
- Map.new(current_version).categories
56
+ get_map.categories
56
57
  end
57
58
 
58
59
  # Get all deprecated ids that would match in the given categories from the current version
@@ -76,8 +77,8 @@ module VRT
76
77
  # @return [VRT::Node|Nil] A valid VRT::Node object or nil if no best match could be found
77
78
  def find_node(vrt_id:, preferred_version: nil, max_depth: 'variant', version: nil) # rubocop:disable Lint/UnusedMethodArgument
78
79
  new_version = preferred_version || current_version
79
- if Map.new(new_version).valid?(vrt_id)
80
- Map.new(new_version).find_node(vrt_id, max_depth: max_depth)
80
+ if get_map(version: new_version).valid?(vrt_id)
81
+ get_map(version: new_version).find_node(vrt_id, max_depth: max_depth)
81
82
  elsif deprecated_node?(vrt_id)
82
83
  find_deprecated_node(vrt_id, preferred_version, max_depth)
83
84
  else
@@ -93,6 +94,11 @@ module VRT
93
94
  other ? @version_json[version] + [OTHER_OPTION] : @version_json[version]
94
95
  end
95
96
 
97
+ def get_map(version: nil)
98
+ version ||= current_version
99
+ @maps[version] ||= Map.new(version)
100
+ end
101
+
96
102
  # Get names of directories matching lib/data/<major>-<minor>/
97
103
  def json_dir_names
98
104
  DIR.entries
@@ -121,6 +127,7 @@ module VRT
121
127
  unload!
122
128
  versions
123
129
  get_json
130
+ get_map
124
131
  last_updated
125
132
  mappings
126
133
  end
@@ -130,6 +137,7 @@ module VRT
130
137
  @versions = nil
131
138
  @version_json = {}
132
139
  @last_update = {}
140
+ @maps = {}
133
141
  @mappings = nil
134
142
  end
135
143
  end
@@ -1,3 +1,3 @@
1
1
  module Vrt
2
- VERSION = '0.4.5'.freeze
2
+ VERSION = '0.4.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barnett Klane
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-18 00:00:00.000000000 Z
13
+ date: 2018-02-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.6.12
140
+ rubygems_version: 2.5.2
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Ruby wrapper for Bugcrowd's Vulnerability Rating Taxonomy