refactor parse_hash based on feedback
This commit is contained in:
parent
efab1677a7
commit
c42f5f8b56
1 changed files with 3 additions and 3 deletions
|
@ -57,17 +57,17 @@ module Gitlab
|
||||||
# +value+ existing model to be included in the hash
|
# +value+ existing model to be included in the hash
|
||||||
# +json_config_hash+ the original hash containing the root model
|
# +json_config_hash+ the original hash containing the root model
|
||||||
def create_model_value(current_key, value, json_config_hash)
|
def create_model_value(current_key, value, json_config_hash)
|
||||||
json_config_hash[current_key] = parse_hash(value, { include: value })
|
json_config_hash[current_key] = parse_hash(value) || { include: value }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Calls attributes finder to parse the hash and add any attributes to it
|
# Calls attributes finder to parse the hash and add any attributes to it
|
||||||
#
|
#
|
||||||
# +value+ existing model to be included in the hash
|
# +value+ existing model to be included in the hash
|
||||||
# +parsed_hash+ the original hash
|
# +parsed_hash+ the original hash
|
||||||
def parse_hash(value, parsed_hash)
|
def parse_hash(value)
|
||||||
@attributes_finder.parse(value) do |hash|
|
@attributes_finder.parse(value) do |hash|
|
||||||
{ include: hash_or_merge(value, hash) }
|
{ include: hash_or_merge(value, hash) }
|
||||||
end || parsed_hash
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adds new model configuration to an existing hash with key +current_key+
|
# Adds new model configuration to an existing hash with key +current_key+
|
||||||
|
|
Loading…
Reference in a new issue