Sha256: fc110e0364c8c56460c26a14622479948533640ad5f68e290e5f3420421997ab

Contents?: true

Size: 719 Bytes

Versions: 2

Compression:

Stored size: 719 Bytes

Contents

module Oxidized::Config::Vars
  # convenience method for accessing node, group or global level user variables
  def vars(name)
    if @node.vars&.has_key?(name)
      @node.vars[name]
    elsif Oxidized.config.groups.has_key?(@node.group) && Oxidized.config.groups[@node.group].vars.has_key?(name.to_s)
      Oxidized.config.groups[@node.group].vars[name.to_s]
    elsif Oxidized.config.models.has_key(@node.model.class.name.to_s.downcase) && Oxidized.config.models[@node.model.class.name.to_s.downcase].vars.has_key?(name.to_s)
      Oxidized.config.models[@node.model.class.name.to_s.downcase].vars[name.to_s]
    elsif Oxidized.config.vars.has_key?(name.to_s)
      Oxidized.config.vars[name.to_s]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oxidized-0.28.0 lib/oxidized/config/vars.rb
oxidized-0.27.0 lib/oxidized/config/vars.rb