Sha256: 39c4ca3cdefc09fa7cf38bb3b32adb8f4dc815423b1ef7897292607b68ac21a8

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

module Oxidized::Config::Vars
  # convenience method for accessing node, group or global level user variables
  # nil values will be ignored
  def vars(name)
    r = @node.vars[name] unless @node.vars.nil?
    if Oxidized.config.groups.has_key?(@node.group)
      r ||= Oxidized.config.groups[@node.group].vars[name.to_s] if Oxidized.config.groups[@node.group].vars.has_key?(name.to_s)
    end
    if Oxidized.config.models.has_key?(@node.model.class.name.to_s.downcase)
      r ||= Oxidized.config.models[@node.model.class.name.to_s.downcase].vars[name.to_s] if Oxidized.config.models[@node.model.class.name.to_s.downcase].vars.has_key?(name.to_s)
    end
    r ||= Oxidized.config.vars[name.to_s] if Oxidized.config.vars.has_key?(name.to_s)
    r
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oxidized-0.26.3 lib/oxidized/config/vars.rb
oxidized-0.26.2 lib/oxidized/config/vars.rb
oxidized-0.26.1 lib/oxidized/config/vars.rb
oxidized-0.26.0 lib/oxidized/config/vars.rb