samvera / hydra-works

A ruby gem implementation of the PCDM Works domain model based on the Samvera software stack
Other
24 stars 14 forks source link

Use services for determining mime type and filename #308

Closed awead closed 8 years ago

awead commented 8 years ago

This will ultimately relate to fixing projecthydra/sufia#2553. We interrogate an incoming object about its original name and mime type, providing a values ffor each based on some logic. Testing this was difficult when it was buried in a private method. This surfaces the methods as services which can be more easily tested, as well as exposed to other consuming applications should they wish to make use of them.

awead commented 8 years ago

@mjgiarlo ok, fixed it up. Incidentally, I changed DetermineMimeType to use the call/initializer strategy. Upon doing that, rubocop started complaining that Assignment Branch Condition size for determine_mime_type is too high 😠 Necessitating private methods.

mjgiarlo commented 8 years ago

@awead RUBOCOP. No good deed, eh? :clap:

awead commented 8 years ago

thanks, @mjgiarlo !