Class: Hyrax::MemberPresenterFactory
- Inherits:
-
Object
- Object
- Hyrax::MemberPresenterFactory
- Defined in:
- app/presenters/hyrax/member_presenter_factory.rb
Overview
Creates the presenters of the members (member works and file sets) of a specific object
Instance Attribute Summary collapse
-
#current_ability ⇒ Object
readonly
Returns the value of attribute current_ability.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#file_set_presenters ⇒ Array<FileSetPresenter>
Presenters for the orderd_members that are FileSets.
-
#initialize(work, ability, request = nil) ⇒ MemberPresenterFactory
constructor
A new instance of MemberPresenterFactory.
-
#member_presenters(ids = ordered_ids, presenter_class = composite_presenter_class) ⇒ Array<presenter_class>
Presenters for the ordered_members (not filtered by class).
-
#work_presenters ⇒ Array<WorkShowPresenter>
Presenters for the ordered_members that are not FileSets.
Constructor Details
#initialize(work, ability, request = nil) ⇒ MemberPresenterFactory
Returns a new instance of MemberPresenterFactory.
11 12 13 14 15 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 11 def initialize(work, ability, request = nil) @work = work @current_ability = ability @request = request end |
Instance Attribute Details
#current_ability ⇒ Object (readonly)
Returns the value of attribute current_ability.
18 19 20 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 18 def current_ability @current_ability end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
18 19 20 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 18 def request @request end |
Instance Method Details
#file_set_presenters ⇒ Array<FileSetPresenter>
Returns presenters for the orderd_members that are FileSets.
30 31 32 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 30 def file_set_presenters @file_set_presenters ||= member_presenters(ordered_ids & file_set_ids) end |
#member_presenters(ids = ordered_ids, presenter_class = composite_presenter_class) ⇒ Array<presenter_class>
Returns presenters for the ordered_members (not filtered by class).
23 24 25 26 27 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 23 def member_presenters(ids = ordered_ids, presenter_class = composite_presenter_class) PresenterFactory.build_for(ids: ids, presenter_class: presenter_class, presenter_args: presenter_factory_arguments) end |
#work_presenters ⇒ Array<WorkShowPresenter>
Returns presenters for the ordered_members that are not FileSets.
35 36 37 |
# File 'app/presenters/hyrax/member_presenter_factory.rb', line 35 def work_presenters @work_presenters ||= member_presenters(ordered_ids - file_set_ids, work_presenter_class) end |