Module: AMS::Registry
- Defined in:
- registry.rb
Class Method Summary (collapse)
-
+ (Boolean) delete(full_path, rel_to_su_reg_path = true)
(also: remove)
Delete registry key or value.
-
+ (Array<String>) get_keys(full_path, rel_to_su_reg_path = true)
Get all keys or 'folders' found in the specified registry path.
-
+ (Hash{String => Fixnum, Bignum, String}) get_values(full_path, rel_to_su_reg_path = true)
Get all values or 'files' and their data found in the specified registry path.
-
+ (String, ...) read(full_path, rel_to_su_reg_path = true)
(also: get)
Get data associated with the registry path.
-
+ (Boolean) write(full_path, value, rel_to_su_reg_path = true)
(also: set)
Set data associated with the registry path.
Class Method Details
+ (Boolean) delete(full_path, rel_to_su_reg_path = true) Also known as: remove
Delete registry key or value.
88 89 90 91 92 |
# File 'registry.rb', line 88 def delete(full_path, rel_to_su_reg_path = true) data = format_path(full_path, rel_to_su_reg_path, true) return false unless data AMS::C.delete_registry(data[0], data[1], data[2]) end |
+ (Array<String>) get_keys(full_path, rel_to_su_reg_path = true)
Get all keys or 'folders' found in the specified registry path.
103 104 105 106 107 108 109 110 111 |
# File 'registry.rb', line 103 def get_keys(full_path, rel_to_su_reg_path = true) data = format_path(full_path, rel_to_su_reg_path, false) return [] unless data keys = AMS::C.get_registry_keys(data[0], data[1]) for i in 0...keys.length keys[i] = keys[i].unpack('C*').pack('U*') end keys end |
+ (Hash{String => Fixnum, Bignum, String}) get_values(full_path, rel_to_su_reg_path = true)
Get all values or 'files' and their data found in the specified registry path.
121 122 123 124 125 126 127 128 129 130 131 |
# File 'registry.rb', line 121 def get_values(full_path, rel_to_su_reg_path = true) data = format_path(full_path, rel_to_su_reg_path, false) return {} unless data hash = AMS::C.get_registry_values(data[0], data[1]) encoded_hash = {} hash.each { |k,v| v = v.unpack('C*').pack('U*') if v.is_a?(String) encoded_hash[k.unpack('C*').pack('U*')] = v } encoded_hash end |
+ (String, ...) read(full_path, rel_to_su_reg_path = true) Also known as: get
Get data associated with the registry path.
54 55 56 57 58 59 60 |
# File 'registry.rb', line 54 def read(full_path, rel_to_su_reg_path = true) data = format_path(full_path, rel_to_su_reg_path, true) return unless data res = AMS::C.read_registry(data[0], data[1], data[2]) res = res.unpack('C*').pack('U*') if res.is_a?(String) res end |
+ (Boolean) write(full_path, value, rel_to_su_reg_path = true) Also known as: set
Set data associated with the registry path.
72 73 74 75 76 77 |
# File 'registry.rb', line 72 def write(full_path, value, rel_to_su_reg_path = true) data = format_path(full_path, rel_to_su_reg_path, true) return false unless data value = value.unpack('U*').pack('C*') if value.is_a?(String) AMS::C.write_registry(data[0], data[1], data[2], value) end |