Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9c639041
Commit
9c639041
authored
May 09, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bit more refactoring of import export reader, fixed rubocop warning
parent
3aee167d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
lib/gitlab/import_export/attributes_finder.rb
lib/gitlab/import_export/attributes_finder.rb
+1
-1
lib/gitlab/import_export/import_export_reader.rb
lib/gitlab/import_export/import_export_reader.rb
+11
-11
No files found.
lib/gitlab/import_export/attributes_finder.rb
View file @
9c639041
...
@@ -32,4 +32,4 @@ module Gitlab
...
@@ -32,4 +32,4 @@ module Gitlab
end
end
end
end
end
end
end
end
\ No newline at end of file
lib/gitlab/import_export/import_export_reader.rb
View file @
9c639041
...
@@ -17,30 +17,30 @@ module Gitlab
...
@@ -17,30 +17,30 @@ module Gitlab
private
private
def
build_hash
(
model_list
)
def
build_hash
(
model_list
)
model_list
.
map
do
|
model_object
|
model_list
.
map
do
|
model_object
_hash
|
if
model_object
.
is_a?
(
Hash
)
if
model_object
_hash
.
is_a?
(
Hash
)
process_
include
(
model_object
)
process_
model_object
(
model_object_hash
)
else
else
@attributes_parser
.
find
(
model_object
)
@attributes_parser
.
find
(
model_object
_hash
)
end
end
end
end
end
end
def
process_
include
(
hash
,
included_classes_hash
=
{})
def
process_
model_object
(
model_object_
hash
,
included_classes_hash
=
{})
hash
.
values
.
flatten
.
each
do
|
value
|
model_object_hash
.
values
.
flatten
.
each
do
|
model_object
|
current_key
=
hash
.
keys
.
first
current_key
=
model_object_
hash
.
keys
.
first
value
=
process_current_class
(
hash
,
included_classes_hash
,
value
)
model_object
=
process_current_class
(
model_object_hash
,
included_classes_hash
,
model_object
)
if
included_classes_hash
[
current_key
]
if
included_classes_hash
[
current_key
]
add_to_class
(
current_key
,
included_classes_hash
,
value
)
add_to_class
(
current_key
,
included_classes_hash
,
model_object
)
else
else
add_new_class
(
current_key
,
included_classes_hash
,
value
)
add_new_class
(
current_key
,
included_classes_hash
,
model_object
)
end
end
end
end
included_classes_hash
included_classes_hash
end
end
def
process_current_class
(
hash
,
included_classes_hash
,
value
)
def
process_current_class
(
hash
,
included_classes_hash
,
value
)
value
=
value
.
is_a?
(
Hash
)
?
process_
include
(
hash
,
included_classes_hash
)
:
value
value
=
value
.
is_a?
(
Hash
)
?
process_
model_object
(
hash
,
included_classes_hash
)
:
value
attributes_hash
=
@attributes_parser
.
find_attributes_only
(
hash
.
keys
.
first
)
attributes_hash
=
@attributes_parser
.
find_attributes_only
(
hash
.
keys
.
first
)
included_classes_hash
[
hash
.
keys
.
first
]
||=
attributes_hash
unless
attributes_hash
.
empty?
included_classes_hash
[
hash
.
keys
.
first
]
||=
attributes_hash
unless
attributes_hash
.
empty?
value
value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment