class

Augeas::File

Inherits Reference / Object

Usually the full path to the config file, needs to be speficied, when getting and setting values. Using this file, this is not needed.

Constructors

new(augeas : Augeas, path : String)

Initiale Augeas::File abstraction, @augeas is needed to perform augeas operations on it, and the @path is the full path to the config file.

augeas = Augeas.new(root: "/path/to")
augeas_file = Augeas::File.new(augeas: augeas, path: "/path/to/config-file")
Source

Instance methods

get(key)

Get a settings value from the config file

Let take postgresql as example, consider we have a config file like this data_directory = '/var/lib/postgresql/8.4/main' # use data in another directory

After instantiating the class, get can be used as:

get("data_directory")
# => "/var/lib/postgresql/8.4/main"
Source
lens_name

Return the lens name for this file

When Augeas loads a file, it associates a lens with it, so this method looks up and returns the lens name

Source
path

Path to the config file, specified in the .new method

Source
set(key, value)

Set a settings value on the config file As Augeas keeps the modifications in memory, don't forget to call Augeas#save after making changes

set("data_directory", "/path/to/data_directory")
Source