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

Reduce duplicated code in content module classes #956

Open
thejourneydude opened this issue Jan 27, 2016 · 5 comments
Open

Reduce duplicated code in content module classes #956

thejourneydude opened this issue Jan 27, 2016 · 5 comments

Comments

@thejourneydude
Copy link

Browsing through code and I spotted nearly duplicated methods inside some of the content module classes. Could meta programming be implemented in this case? Maybe that's overkill and/or be super low-priority. Just thought I would throw in my two cents.

Reference: https://github.com/openstax/tutor-server/blob/50b622fb63f7dc26567f868a2828b5c29d5a206d/app/subsystems/content/exercise.rb

@nathanstitt
Copy link
Member

Yep, we've got the wrap_attributes method that accomplishes that. https://github.com/openstax/tutor-server/blob/master/lib/wrapper.rb#L41-L53 It's used in: https://github.com/openstax/tutor-server/blob/master/app/subsystems/catalog/offering.rb#L8-L10

I'm guessing the code you spotted pre-dates the wrapper method or maybe it didn't work with it for some reason?

@thejourneydude
Copy link
Author

I was about to go look over at the Wrapper class. Thanks! Super new to the code so my apologizes.

@nathanstitt
Copy link
Member

Oh no worries at all! I wrote the wrapper but it looks like the instance I linked to is the only user of it :)

@Dantemss
Copy link
Member

This would prob be a nice cleanup task for when you feel bored :)

@jpslav
Copy link
Member

jpslav commented Mar 14, 2016

Work on in sustain if no other bugs to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants