Class: MetadataPresenter::TraversedPages
- Inherits:
-
Object
- Object
- MetadataPresenter::TraversedPages
- Defined in:
- app/models/metadata_presenter/traversed_pages.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#user_data ⇒ Object
readonly
Returns the value of attribute user_data.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(service, user_data, current_page = nil) ⇒ TraversedPages
constructor
A new instance of TraversedPages.
Constructor Details
#initialize(service, user_data, current_page = nil) ⇒ TraversedPages
Returns a new instance of TraversedPages.
5 6 7 8 9 10 |
# File 'app/models/metadata_presenter/traversed_pages.rb', line 5 def initialize(service, user_data, current_page = nil) @service = service @user_data = user_data @pages = [service.start_page] @current_page = current_page end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
3 4 5 |
# File 'app/models/metadata_presenter/traversed_pages.rb', line 3 def current_page @current_page end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
3 4 5 |
# File 'app/models/metadata_presenter/traversed_pages.rb', line 3 def service @service end |
#user_data ⇒ Object (readonly)
Returns the value of attribute user_data.
3 4 5 |
# File 'app/models/metadata_presenter/traversed_pages.rb', line 3 def user_data @user_data end |
Instance Method Details
#all ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/metadata_presenter/traversed_pages.rb', line 14 def all next_object = service.start_page service.flow.size.times do break if next_object.blank? || next_object.uuid == current_page&.uuid flow_object = service.flow_object(next_object.uuid) next_object = flow_object.branch? ? evaluated_page(flow_object) : next_flow_object(flow_object.default_next) @pages.push(next_object) if page_in_flow?(next_object) end @pages end |