Last active
December 15, 2015 05:39
-
-
Save knewter/5210437 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
require 'entities/pages/page' | |
require_relative '../../presenters/abc/page_presenter' # Need to do load path manip? | |
module Abc | |
module Conductors | |
module Pages | |
class FetchesPages # This can be extracted into a parent "BasicListConductor" | |
def call | |
presenters | |
end | |
private | |
def repo | |
Abc::Adapters::Persistence::Repositories::Page | |
end | |
def presenters | |
entities.map{|p| presenter.new(p) } | |
end | |
def entities | |
# NOTE: Seems odd that the entity doesn't just take attributes hash in | |
# If that weren't the case, we could take lots of advantage of generic | |
# overridable methods a little easier | |
persisted_data.map{|p| entity.new(p[:title]) } | |
end | |
def entity | |
Abc::Entities::Page | |
end | |
def presenter | |
Abc::Presenters::PagePresenter | |
end | |
def persisted_data | |
repo.search({}) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment