Module: Confix::RootInstanceMethods

Defined in:
lib/confix.rb

Overview

Root instance methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assignsHash (readonly)

Returns Assignment variables. These are available as interpolation arguments in any string setting. You can modify this hash.

Returns:

  • (Hash)

    Assignment variables. These are available as interpolation arguments in any string setting. You can modify this hash.



112
113
114
# File 'lib/confix.rb', line 112

def assigns
  @assigns ||= {}
end

Instance Method Details

#child?Boolean

Determines whether this configuration is a child configuration.

Returns:

  • (Boolean)


117
118
119
# File 'lib/confix.rb', line 117

def child?
  false
end

#config_rootObject

Gets the config root (this object).



129
130
131
# File 'lib/confix.rb', line 129

def config_root
  self
end

#configsObject

Gets a hash containing intermediate configuration objects.



139
140
141
# File 'lib/confix.rb', line 139

def configs
  @configs ||= {}
end

#fetch(name, default) ⇒ Object



121
122
123
124
125
126
# File 'lib/confix.rb', line 121

def fetch(name, default)
  value = values[name]
  value = default if value.nil?
  value = value % assigns if value.is_a?(String)
  value
end

#valuesObject

Gets all configuration values.



134
135
136
# File 'lib/confix.rb', line 134

def values
  @values ||= {}
end