Created
August 19, 2015 05:47
-
-
Save raderj89/01b95336431738b86e86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FetchingProgressInstance | |
attr_reader :enrollment, :roadmap | |
def initialize(enrollment, roadmap) | |
@enrollment = enrollment | |
@roadmap = roadmap | |
assign_progress_fetcher(@enrollment) | |
end | |
def fetch_progress | |
enrollment.progress_for(roadmap) | |
end | |
private | |
def assign_progress_fetcher(enrollment) | |
enrollment.extend(ProgressFetcher) | |
end | |
module ProgressFetcher | |
def progress_for(given_roadmap) | |
if roadmap == given_roadmap | |
# return progress | |
elsif has_roadmap?(given_roadmap) | |
# determine whether the roadmap is for a previous | |
# enrollment state or a future enrollment state | |
# and return the progress instance for it | |
end | |
end | |
# more methods | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment