Skip to content

Instantly share code, notes, and snippets.

@knewter
Last active December 15, 2015 05:39
Show Gist options
  • Save knewter/5210437 to your computer and use it in GitHub Desktop.
Save knewter/5210437 to your computer and use it in GitHub Desktop.
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