linux-kstat 0.2.7-universal-linux → 0.2.8-universal-linux

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
2
  SHA256:
3
- metadata.gz: b82d1f048b54e608c00c657ba80aaa56cb59f1419bedf75f542010d258ae19c1
4
- data.tar.gz: c6c9974612a18126e39249b257962eae3cdaaf0f5e90693d9009360d8d3f8b5a
3
+ metadata.gz: e193e5bb9555bf697c749f74f73d5cc9d0ead99072235e027f97d9f1fed4645d
4
+ data.tar.gz: 1377fdf553ee873d8acbd40c849e55205467e443c3e41ebf697a3dcf62f9b6ab
5
5
  SHA512:
6
- metadata.gz: 00b1b9c55ea70c6b20bcb3db8fdb0a98ad24bda5c5caf5467049a9543a460837af3d419d0783a48c2f47b9410311b9ba4b44ace86583d7669cd2cdb659090232
7
- data.tar.gz: 9e99699d334b264d792653444b5514662ca65c65809e07e74e3e666b294c6062aa4060874526ae2ace4fbb4616f69dfd94e7d590d949bb8ae840b498831a0d59
6
+ metadata.gz: f2c0c13badaaaeac7de87d4c60df7d653bb739705c3a7289b709dd7f99001c8c49172429693c32a1d2983a3b793cc6efbe13917056fa9b5a25ae4fb4fe79d5d0
7
+ data.tar.gz: cadfd737b379423f7f05d7a0509b7fbfd7a7d77053bda59bd732f74d50d4b3f35652bbd867653fd0a3c2b8be2ec93b6ab994fbc9ba4d7d007ddca9e1e09ef958
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.8 - 13-Jun-2025
2
+ * Minor optimization where I avoid making repeated calls.
3
+ * Add a keys method delegator.
4
+
1
5
  ## 0.2.7 - 20-Apr-2024
2
6
  * Rubocop updates.
3
7
  * Spec updates.
data/README.md CHANGED
@@ -54,7 +54,7 @@ Apache-2.0
54
54
 
55
55
  ## Copyright
56
56
 
57
- (C) 2003-2020 Daniel J. Berger
57
+ (C) 2003-2024 Daniel J. Berger
58
58
  All Rights Reserved.`
59
59
 
60
60
  ## Warranty
data/Rakefile CHANGED
@@ -31,4 +31,9 @@ RSpec::Core::RakeTask.new(:spec) do |t|
31
31
  t.pattern = ['spec/*.rb']
32
32
  end
33
33
 
34
+ # Clean up afterwards
35
+ Rake::Task[:spec].enhance do
36
+ Rake::Task[:clean].invoke
37
+ end
38
+
34
39
  task :default => :spec
data/lib/linux/kstat.rb CHANGED
@@ -9,13 +9,14 @@ module Linux
9
9
  extend Forwardable
10
10
 
11
11
  # The version of the linux-kstat library
12
- VERSION = '0.2.7'
12
+ VERSION = '0.2.8'
13
13
 
14
14
  # :stopdoc:
15
15
 
16
16
  # Delegate the the [] and inspect methods to the @hash variable
17
17
  def_delegator(:@hash, :[])
18
18
  def_delegator(:@hash, :inspect)
19
+ def_delegator(:@hash, :keys)
19
20
 
20
21
  # :startdoc:
21
22
 
@@ -56,9 +57,12 @@ module Linux
56
57
 
57
58
  File.readlines('/proc/stat').each do |line|
58
59
  info = line.split
60
+ next if info.empty?
61
+ key = info.first.to_sym
62
+
59
63
  unless info.empty?
60
64
  if info.first =~ /^cpu/i
61
- hash[info.first.to_sym] = {
65
+ hash[key] = {
62
66
  :user => info[1].to_i,
63
67
  :nice => info[2].to_i,
64
68
  :system => info[3].to_i,
@@ -71,9 +75,9 @@ module Linux
71
75
  :guest_nice => info[10].to_i
72
76
  }
73
77
  elsif info.size > 2
74
- hash[info.first.to_sym] = info[1..-1].map(&:to_i)
78
+ hash[key] = info[1..-1].map(&:to_i)
75
79
  else
76
- hash[info.first.to_sym] = info[1].to_i
80
+ hash[key] = info[1].to_i
77
81
  end
78
82
  end
79
83
  end
data/linux-kstat.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'linux-kstat'
5
- gem.version = '0.2.7'
5
+ gem.version = '0.2.8'
6
6
  gem.license = 'Apache-2.0'
7
7
  gem.author = 'Daniel J. Berger'
8
8
  gem.email = 'djberg96@gmail.com'
@@ -17,7 +17,10 @@ Gem::Specification.new do |gem|
17
17
  gem.add_development_dependency('rubocop-rspec')
18
18
  gem.add_development_dependency('rspec', '~> 3.9')
19
19
 
20
- gem.platform = Gem::Platform.new(['universal', 'linux'])
20
+ # Don't build this gem with Java-based implementations
21
+ if RUBY_ENGINE !~ /truffleruby|jruby/i
22
+ gem.platform = Gem::Platform.new(['universal', 'linux'])
23
+ end
21
24
 
22
25
  gem.metadata = {
23
26
  'homepage_uri' => 'https://github.com/djberg96/linux-kstat',
@@ -26,7 +29,9 @@ Gem::Specification.new do |gem|
26
29
  'documentation_uri' => 'https://github.com/djberg96/linux-kstat/wiki',
27
30
  'source_code_uri' => 'https://github.com/djberg96/linux-kstat',
28
31
  'wiki_uri' => 'https://github.com/djberg96/linux-kstat/wiki',
29
- 'rubygems_mfa_required' => 'true'
32
+ 'rubygems_mfa_required' => 'true',
33
+ 'github_repo' => 'https://github.com/djberg96/linux-kstat',
34
+ 'funding_uri' => 'https://github.com/sponsors/djberg96'
30
35
  }
31
36
 
32
37
  gem.description = <<-EOF
@@ -13,7 +13,7 @@ describe Linux::Kstat do
13
13
 
14
14
  context 'constants' do
15
15
  it 'defines a version constant that is set to the expected value' do
16
- expect(Linux::Kstat::VERSION).to eql('0.2.7')
16
+ expect(Linux::Kstat::VERSION).to eql('0.2.8')
17
17
  expect(Linux::Kstat::VERSION).to be_frozen
18
18
  end
19
19
  end
@@ -31,6 +31,12 @@ describe Linux::Kstat do
31
31
  expect(kstat[:intr]).to be_a(Array)
32
32
  end
33
33
 
34
+ it 'delegates the keys method' do
35
+ expect(kstat).to respond_to(:keys)
36
+ expect(kstat.keys).to be_a(Array)
37
+ expect(kstat.keys).to include(:cpu)
38
+ end
39
+
34
40
  it 'does not allow key assignment' do
35
41
  expect{ kstat[:cpu] = 'test' }.to raise_error(NoMethodError)
36
42
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux-kstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: universal-linux
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain:
11
10
  - |
@@ -35,7 +34,7 @@ cert_chain:
35
34
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
35
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
36
  -----END CERTIFICATE-----
38
- date: 2024-04-20 00:00:00.000000000 Z
37
+ date: 2025-06-13 00:00:00.000000000 Z
39
38
  dependencies:
40
39
  - !ruby/object:Gem::Dependency
41
40
  name: rake
@@ -123,7 +122,8 @@ metadata:
123
122
  source_code_uri: https://github.com/djberg96/linux-kstat
124
123
  wiki_uri: https://github.com/djberg96/linux-kstat/wiki
125
124
  rubygems_mfa_required: 'true'
126
- post_install_message:
125
+ github_repo: https://github.com/djberg96/linux-kstat
126
+ funding_uri: https://github.com/sponsors/djberg96
127
127
  rdoc_options: []
128
128
  require_paths:
129
129
  - lib
@@ -138,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.4.19
142
- signing_key:
141
+ rubygems_version: 3.6.1
143
142
  specification_version: 4
144
143
  summary: Ruby interface for Linux kernel stats in /proc/stat
145
144
  test_files:
metadata.gz.sig CHANGED
Binary file