kanrisuru 0.16.4 → 0.16.5

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: e33daa1aa8d51a7f8a9e6efb4e77933ef5a71e1ce3e428dabc7f44468bde79b3
4
- data.tar.gz: 8cbc4f168fdf88bdd22c8fb237018c65427010356ed8d1bfe9771f2e8ecfc0ca
3
+ metadata.gz: 44eda2d0bb8165ff1df3d763531ffdb64a442b390e6e97ccda473105ddd8b04b
4
+ data.tar.gz: 14967498be11e552b7f546984173abf279387649da8fc9d45a98b42ed06aaa4f
5
5
  SHA512:
6
- metadata.gz: 992f48fbc7c55a67cd2bfa649cba991620ab0ee6aa97d4c49de918d099a1e9963a30dea99aa71fe738ad39982462e731caf4ab121263a0bbf4870a68ae5a1e83
7
- data.tar.gz: 208b2389785ed015055a3c67b49b433dae7d5388ee32334af5d74f7a2f94db19900a1dba4396b02edc675987fadead7b90d3f961e3eddb9e5e7c35c946ac28fe
6
+ metadata.gz: 5c281ab5f1e6fa063a5f11df3cb7138fe0acd19bb810aaf2e01685b847a1ec7d972420c86e155bc32b23a9d9bf1796077dfa753edfa0c62f7ec671ee81198d09
7
+ data.tar.gz: 7c64b72d543a18e1eee6d8dad9530c7e281a3856003b15d5587bf1351dd55fbbb49a8177e2c8a8cc749549f587e2b42fe76692dd436f0b1d9f57431d9e36cb9e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## Kanrisuru 0.16.5 (December 25, 2021) ##
2
+ * Refactor `dmi_field_translate` to reduce complexity.
3
+
1
4
  ## Kanrisuru 0.16.4 (December 25, 2021) ##
2
5
  * Refactor `Kanrisuru::Fstab::Entry` and `Kanrisuru::Fstab::Options` classes into separate files.
3
6
 
@@ -93,37 +93,41 @@ module Kanrisuru
93
93
  end
94
94
 
95
95
  def dmi_field_translate(struct, field)
96
- field = field.downcase
97
- field = field.gsub(/\s/, '_')
98
- field = field.gsub('-', '_')
99
- field = field.gsub(':', '')
96
+ field = dmi_scrub_field(field)
100
97
 
101
98
  case struct.dmi_type
102
99
  when 'Memory Device'
103
100
  case field
104
101
  when 'size'
105
- return 'mem_size'
102
+ 'mem_size'
106
103
  end
107
104
  when 'System Slots'
108
105
  case field
109
106
  when 'length'
110
- return 'slot_length'
107
+ 'slot_length'
111
108
  end
112
109
  when 'OEM Strings'
113
110
  case field
114
111
  when /^string/
115
- return 'strings'
112
+ 'strings'
116
113
  end
117
114
  when 'Boot Integrity Services'
118
115
  case field
119
116
  when '16_bit_entry_point_address'
120
- return 'sixteen_bit_entry_point_address'
117
+ 'sixteen_bit_entry_point_address'
121
118
  when '32_bit_entry_point_address'
122
- return 'thirty_two_bit_entry_point_address'
119
+ 'thirty_two_bit_entry_point_address'
123
120
  end
121
+ else
122
+ field
124
123
  end
124
+ end
125
125
 
126
- field
126
+ def dmi_scrub_field(field)
127
+ field = field.downcase
128
+ field = field.gsub(/\s/, '_')
129
+ field = field.gsub('-', '_')
130
+ field.gsub(':', '')
127
131
  end
128
132
 
129
133
  def dmi_type_to_struct(type)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.16.4'
4
+ VERSION = '0.16.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.4
4
+ version: 0.16.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina