Class: Wizardry::Framework
- Inherits:
-
Object
- Object
- Wizardry::Framework
- Defined in:
- lib/wizardry/framework.rb
Overview
Framework holds data on how the wizard itself is constructed. It’ll be the same for every instance
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#completion_flag ⇒ Object
Returns the value of attribute completion_flag.
-
#edit_path_helper ⇒ Object
Returns the value of attribute edit_path_helper.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pages ⇒ Object
Returns the value of attribute pages.
-
#update_path_helper ⇒ Object
Returns the value of attribute update_path_helper.
Instance Method Summary collapse
- #branch_pages ⇒ Object
- #cookie_name ⇒ Object
-
#initialize(name:, pages:, class_name:, edit_path_helper:, update_path_helper:, completion_flag: 'complete') ⇒ Framework
constructor
A new instance of Framework.
- #page(name) ⇒ Object
- #page_names ⇒ Object
- #trunk_pages ⇒ Object
Constructor Details
#initialize(name:, pages:, class_name:, edit_path_helper:, update_path_helper:, completion_flag: 'complete') ⇒ Framework
Returns a new instance of Framework.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/wizardry/framework.rb', line 7 def initialize(name:, pages:, class_name:, edit_path_helper:, update_path_helper:, completion_flag: 'complete') @name = name @pages = setup_pages(pages) @class_name = class_name @edit_path_helper = edit_path_helper @update_path_helper = update_path_helper @completion_flag = completion_flag page_sense_check end |
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def class_name @class_name end |
#completion_flag ⇒ Object
Returns the value of attribute completion_flag.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def completion_flag @completion_flag end |
#edit_path_helper ⇒ Object
Returns the value of attribute edit_path_helper.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def edit_path_helper @edit_path_helper end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def name @name end |
#pages ⇒ Object
Returns the value of attribute pages.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def pages @pages end |
#update_path_helper ⇒ Object
Returns the value of attribute update_path_helper.
5 6 7 |
# File 'lib/wizardry/framework.rb', line 5 def update_path_helper @update_path_helper end |
Instance Method Details
#branch_pages ⇒ Object
30 31 32 |
# File 'lib/wizardry/framework.rb', line 30 def branch_pages pages.select(&:branch?) end |
#cookie_name ⇒ Object
18 19 20 |
# File 'lib/wizardry/framework.rb', line 18 def %(#{@name}-wizard) end |
#page(name) ⇒ Object
34 35 36 |
# File 'lib/wizardry/framework.rb', line 34 def page(name) pages.detect { |p| p.name == name } end |
#page_names ⇒ Object
22 23 24 |
# File 'lib/wizardry/framework.rb', line 22 def page_names pages.map(&:name) end |
#trunk_pages ⇒ Object
26 27 28 |
# File 'lib/wizardry/framework.rb', line 26 def trunk_pages pages.reject(&:branch?) end |