Class: Wx::Config

Inherits:
ConfigBase show all
Includes:
Wx::ConfigBase::Interface
Defined in:
lib/wx/doc/config.rb

Overview

Configuration class for wxRuby which stores it’s settings in a (possibly nested) Hash. This way configurations can be easily persisted using any commonly used Ruby methods like YAML or JSON files.

Wx::Config supports Boolean (true or false), Integer, Float and String values and nested groups (essentially nested hashes). Any entry values set will be sanitized to match the supported types, i.e. if the value matches a supported type the value is accepted unaltered otherwise Integer (to_int), Float (to_f) or String (to_s) coercion are applied (in that order). Hash values are installed as nested groups.

Like the C++ wxConfigBase derivatives Wx::Config supports arbitrary access using path strings which support absolute paths (‘/xxxx’) and relative paths (‘xxx/xxx’, ‘../xxx’, ‘./xxxx’). Relative segments can also be embedded in the path strings (‘/aaa/bbb/../ccc’).

Defined Under Namespace

Classes: Group

Constant Summary

Constants inherited from ConfigBase

Wx::ConfigBase::SEPARATOR

Instance Method Summary collapse

Methods included from Wx::ConfigBase::Interface

#[], #delete, #each_entry, #each_group, #get, #has_entry?, #has_group?, #number_of_entries, #number_of_groups, #parent, #path, #read, #rename, #root, #root?, #set, #to_h, #to_s, #write

Methods inherited from ConfigBase

create, get, set

Constructor Details

#initialize(hash = nil) ⇒ Wx::Config

Constructor.

Parameters:

  • hash (Hash) (defaults to: nil)

    optional Hash initializing configuration object



226
# File 'lib/wx/doc/config.rb', line 226

def initialize(hash = nil)end

Instance Method Details

#cleartrue

Deletes all configuration content and returns if successful.

Returns:

  • (true)


230
# File 'lib/wx/doc/config.rb', line 230

def clear; end

#is_expanding_env_varsBoolean Also known as: expanding_env_vars?

Returns true if we are expanding environment variables in string values, false otherwise.

Returns:

  • (Boolean)


240
# File 'lib/wx/doc/config.rb', line 240

def is_expanding_env_vars; end

#replace(hash) ⇒ self

Replaces the configuration content with the content of the provided Hash. Values will be sanitized (see Wx::Config).

Parameters:

  • hash (Hash)

    content to replace configuration

Returns:

  • (self)


236
# File 'lib/wx/doc/config.rb', line 236

def replace(hash) end

#set_expand_env_vars(flag) ⇒ Object Also known as: expand_env_vars

Determine whether we wish to expand environment variables in string values.

Parameters:

  • flag (Boolean)

    enables expanding environment variables if true, disables otherwise



245
# File 'lib/wx/doc/config.rb', line 245

def set_expand_env_vars(flag) end