Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add file_converter_service which converts the metadata between AF:File and FileMetadata resource #4014

Merged
merged 1 commit into from
Sep 19, 2019

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented Sep 18, 2019

Provides conversions between AF:Files and FileMetadata resources.

  • af_file_to_resource(af_file:)
  • resource_to_af_file(metadata_resource:)

@elrayle elrayle added the wings label Sep 18, 2019
@elrayle elrayle self-assigned this Sep 18, 2019
@elrayle elrayle force-pushed the wings/file_metadata_conversion branch 3 times, most recently from 9d81988 to 44b9eeb Compare September 18, 2019 20:05
end

def content(metadata_resource)
return nil if metadata_resource.content.nil? || metadata_resource.content.size.zero?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we expecting metadata_resource.content to be nil or an Array? i'm wondering about the impact of size.zero? vs empty?. size is normally going to 0 or 1 i'd guess?

will return nil if metadata_resource.content.blank? work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to set the content in the AF:File. When there is no content (i.e. nil or []), then the content in the AF:File will be nil. If there is an empty string (i.e. ['']), then the content in the AF:File should be an empty string.

I confirmed that blank? works for all 3 of these conditions.

no-reply
no-reply previously approved these changes Sep 19, 2019
@elrayle elrayle merged commit 6ee9af3 into master Sep 19, 2019
@elrayle elrayle deleted the wings/file_metadata_conversion branch September 19, 2019 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants