Class: Qt::Settings::Group
Instance Method Summary collapse
- #delete_group ⇒ Object
- #each_group ⇒ Object
- #entry_map ⇒ Object
- #exists ⇒ Object
- #group(name) ⇒ Object
- #group_list ⇒ Object
-
#initialize(settings, prefix) ⇒ Group
constructor
A new instance of Group.
- #name ⇒ Object
- #read_entry(key, default_value = nil) ⇒ Object
- #sync ⇒ Object
- #write_entry(key, value) ⇒ Object
Constructor Details
#initialize(settings, prefix) ⇒ Group
Returns a new instance of Group.
244 245 246 247 |
# File 'lib/rui/toolkits/qt/qt.rb', line 244 def initialize(settings, prefix) @settings = settings @prefix = prefix end |
Instance Method Details
#delete_group ⇒ Object
255 256 257 |
# File 'lib/rui/toolkits/qt/qt.rb', line 255 def delete_group @settings.remove(@prefix) end |
#each_group ⇒ Object
291 292 293 294 295 296 297 298 |
# File 'lib/rui/toolkits/qt/qt.rb', line 291 def each_group names = in_group do @settings.child_groups end names.each do |name| yield group(name) end end |
#entry_map ⇒ Object
282 283 284 285 286 287 288 289 |
# File 'lib/rui/toolkits/qt/qt.rb', line 282 def entry_map in_group do @settings.child_keys.inject({}) do |res, key| res[key] = @settings.value(key).toString res end end end |
#exists ⇒ Object
249 250 251 252 253 |
# File 'lib/rui/toolkits/qt/qt.rb', line 249 def exists in_group do not @settings.all_keys.empty? end end |
#group(name) ⇒ Object
259 260 261 |
# File 'lib/rui/toolkits/qt/qt.rb', line 259 def group(name) Group.new(@settings, prefixed(name)) end |
#group_list ⇒ Object
276 277 278 279 280 |
# File 'lib/rui/toolkits/qt/qt.rb', line 276 def group_list in_group do @settings.child_groups end end |
#name ⇒ Object
300 301 302 303 304 305 306 |
# File 'lib/rui/toolkits/qt/qt.rb', line 300 def name if @prefix =~ /\/([^\/]+)$/ $1 else @prefix end end |
#read_entry(key, default_value = nil) ⇒ Object
268 269 270 |
# File 'lib/rui/toolkits/qt/qt.rb', line 268 def read_entry(key, default_value = nil) @settings.value(prefixed(key)).toString || default_value end |
#sync ⇒ Object
272 273 274 |
# File 'lib/rui/toolkits/qt/qt.rb', line 272 def sync @settings.sync end |