Revision d7c67746
Added by Michael Moll almost 6 years ago
app/services/foreman/importer_puppetclass.rb | ||
---|---|---|
def self.suggest_key_type(value, default = nil, detect_json_or_yaml = false)
|
||
case value
|
||
when String
|
||
begin
|
||
return "json" if JSON.load value
|
||
rescue
|
||
return "yaml" if YAML.load value
|
||
end if detect_json_or_yaml
|
||
if detect_json_or_yaml
|
||
begin
|
||
return "json" if JSON.load value
|
||
rescue
|
||
return "yaml" if YAML.load value
|
||
end
|
||
end
|
||
"string"
|
||
when TrueClass, FalseClass
|
||
"boolean"
|
Also available in: Unified diff
Fixes #19873 - Fix Style/MultilineIfModifier cop (#5705)