Class: Puppet::Settings::ValueTranslator

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/settings/value_translator.rb

Overview

Convert arguments into booleans, integers, or whatever.

Instance Method Summary collapse

Instance Method Details

#[](value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/puppet/settings/value_translator.rb', line 5

def [](value)
  # Handle different data types correctly
  return case value
         when /^false$/i; false
         when /^true$/i; true
         when true; true
         when false; false
         else
           value.gsub(/^["']|["']$/,'').sub(/\s+$/, '')
         end
end