diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-10-04 14:37:09 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-10-09 13:55:45 +0900 |
| commit | 4eda289a13c61347c28cbb327d07e5064583904d (patch) | |
| tree | 26b51eb1affda8db6af44bcf0bd4fb03d2b8aedd /ext | |
| parent | fc2efc2bdb5e8f48b83757d8de1ae90750150e84 (diff) | |
Sync from ruby/win32-registry
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11791
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/win32/lib/win32/registry.rb | 20 | ||||
| -rw-r--r-- | ext/win32/win32-registry.gemspec | 29 |
2 files changed, 42 insertions, 7 deletions
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb index c801b1327b..e84653d945 100644 --- a/ext/win32/lib/win32/registry.rb +++ b/ext/win32/lib/win32/registry.rb @@ -69,11 +69,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr WCHAR_NUL = "\0".encode(WCHAR).freeze WCHAR_CR = "\r".encode(WCHAR).freeze WCHAR_SIZE = WCHAR_NUL.bytesize - begin - LOCALE = Encoding.find(Encoding.locale_charmap) - rescue ArgumentError - LOCALE = Encoding::UTF_8 - end + LOCALE = Encoding::UTF_8 class Registry @@ -567,9 +563,16 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr end # - # Enumerate values. + # Enumerate all values in this registry path. + # + # For each value it yields key, type and data. + # + # key is a String which contains name of key. + # type is a type contant kind of Win32::Registry::REG_* + # data is the value of this key. # def each_value + return enum_for(:each_value) unless block_given? index = 0 while true begin @@ -600,13 +603,16 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr end # - # Enumerate subkeys. + # Enumerate all subkeys. + # + # For each subkey it yields subkey and wtime. # # subkey is String which contains name of subkey. # wtime is last write time as FILETIME (64-bit integer). # (see Registry.wtime2time) # def each_key + return enum_for(:each_key) unless block_given? index = 0 while true begin diff --git a/ext/win32/win32-registry.gemspec b/ext/win32/win32-registry.gemspec new file mode 100644 index 0000000000..b6df247574 --- /dev/null +++ b/ext/win32/win32-registry.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true +Gem::Specification.new do |spec| + spec.name = "win32-registry" + spec.version = "0.0.1" + spec.authors = ["U.Nakamura"] + spec.email = ["usa@garbagecollect.jp"] + + spec.summary = %q{Provides an interface to the Windows Registry in Ruby} + spec.description = spec.summary + spec.homepage = "https://github.com/ruby/win32-registry" + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = spec.homepage + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile]) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_dependency "fiddle", "~> 1.0" +end |
