Module: Gitlab::GithubImport::Representation::ToHash
- Included in:
- Gitlab::GithubGistsImport::Representation::Gist, Collaborator, DiffNote, Issue, IssueEvent, LfsObject, Note, NoteText, ProtectedBranch, PullRequest, PullRequestReview, PullRequests::ReviewRequests, User
- Defined in:
- lib/gitlab/github_import/representation/to_hash.rb
Instance Method Summary collapse
- #convert_value_for_to_hash(value) ⇒ Object
-
#to_hash ⇒ Object
Converts the current representation to a Hash.
Instance Method Details
#convert_value_for_to_hash(value) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/github_import/representation/to_hash.rb', line 19 def convert_value_for_to_hash(value) if value.is_a?(Array) value.map { |v| convert_value_for_to_hash(v) } elsif value.respond_to?(:to_hash) value.to_hash else value end end |
#to_hash ⇒ Object
Converts the current representation to a Hash. The keys of this Hash will be Symbols.
9 10 11 12 13 14 15 16 17 |
# File 'lib/gitlab/github_import/representation/to_hash.rb', line 9 def to_hash hash = {} attributes.each do |key, value| hash[key] = convert_value_for_to_hash(value) end hash end |