Sha256: db07930fb58e98029c7449dbf14f4d0fcff3bdb66adb46a6bdc4352aade7e6ba

Contents?: true

Size: 794 Bytes

Versions: 7

Compression:

Stored size: 794 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)
      if Oxidized.config.groups[@node.group].vars.has_key?(name.to_s)
        r ||= Oxidized.config.groups[@node.group].vars[name.to_s]
      end
    end
    if Oxidized.config.models.has_key?(@node.model.class.name.to_s.downcase)
      if Oxidized.config.models[@node.model.class.name.to_s.downcase].vars.has_key?(name.to_s)
        r ||= Oxidized.config.models[@node.model.class.name.to_s.downcase].vars[name.to_s]
      end
    end
    r ||= Oxidized.config.vars[name.to_s] if Oxidized.config.vars.has_key?(name.to_s)
    r
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
oxidized-0.25.1 lib/oxidized/config/vars.rb
oxidized-0.25.0 lib/oxidized/config/vars.rb
oxidized-0.24.0 lib/oxidized/config/vars.rb
oxidized-0.23.0 lib/oxidized/config/vars.rb
oxidized-0.22.0 lib/oxidized/config/vars.rb
oxidized-0.21.0 lib/oxidized/config/vars.rb
oxidized-0.20.0 lib/oxidized/config/vars.rb