Skip to content

Commit

Permalink
Use case compare for the other ones too
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed Oct 24, 2018
1 parent 6f970b0 commit d6ad1a1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/miq_automation_engine/engine/miq_ae_engine/miq_ae_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,15 @@ def self.convert_boolean_value(value)

def self.convert_value_based_on_datatype(value, datatype)
return value if value.blank?

# Basic Types
return convert_boolean_value(value) if datatype == 'boolean'
return true if datatype == 'TrueClass'
return false if datatype == 'FalseClass'
return Time.parse(value) if datatype == 'time' || datatype == 'Time'
return value.to_sym if datatype == 'symbol' || datatype == 'Symbol'
return value.to_i if datatype.casecmp?('integer') || datatype == 'Fixnum'
return value.to_f if datatype == 'float' || datatype == 'Float'
return value.gsub(/[\[\]]/, '').strip.split(/\s*,\s*/) if datatype == 'array' && value.class == String
return Time.parse(value) if datatype&.casecmp?('time')
return value.to_sym if datatype&.casecmp?('symbol')
return value.to_i if datatype&.casecmp?('integer') || datatype == 'Fixnum'
return value.to_f if datatype&.casecmp?('float')
return value.gsub(/[\[\]]/, '').strip.split(/\s*,\s*/) if datatype == 'array' && value.class == String
return decrypt_password(value) if datatype == 'password'

if datatype &&
Expand Down

0 comments on commit d6ad1a1

Please sign in to comment.