Skip to content

Commit

Permalink
Minor bug fix: SUBSENGG-6138
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-navaneedhan committed May 25, 2020
1 parent 31436cf commit c18cdd8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions ruby/lib/chargebee/models/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ def load(values)
instance_eval do
values.each do |k, v|
set_val = nil
case v
when Hash && (@dependant_types[k] != nil)
next
when Hash
set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
when Array
if(@sub_types[k] != nil)
set_val = v.map { |item| @sub_types[k].construct(item)}
else
set_val = v
end
else
set_val = v
end
next if v.is_a?(Hash) && @dependant_types[k] != nil

set_val = if v.is_a?(Hash)
(@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
elsif v.is_a?(Array)
if @sub_types[k] != nil
v.map { |item| @sub_types[k].construct(item)}
else
v
end
else
v
end

instance_variable_set("@#{k}", set_val)
end
end
Expand Down

0 comments on commit c18cdd8

Please sign in to comment.