Module: MultiStep::ImportHelpers
- Included in:
- Importable::Importer
- Defined in:
- lib/importable/multi_step/import_helpers.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #first_step? ⇒ Boolean
- #last_step? ⇒ Boolean
- #next_step ⇒ Object
- #previous_step ⇒ Object
- #steps ⇒ Object
Instance Attribute Details
#current_step ⇒ Object
9 10 11 |
# File 'lib/importable/multi_step/import_helpers.rb', line 9 def current_step @current_step || steps.first end |
Instance Method Details
#first_step? ⇒ Boolean
31 32 33 |
# File 'lib/importable/multi_step/import_helpers.rb', line 31 def first_step? current_step == steps.first end |
#last_step? ⇒ Boolean
35 36 37 |
# File 'lib/importable/multi_step/import_helpers.rb', line 35 def last_step? current_step == steps.last end |
#next_step ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/importable/multi_step/import_helpers.rb', line 13 def next_step distance = 1 # skip choose worksheet step if there's only 1 worksheet if self.current_step == 'upload_file' and self.sheets.length <= 1 distance = 2 end self.current_step = steps[steps.index(current_step) + distance] end |
#previous_step ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/importable/multi_step/import_helpers.rb', line 22 def previous_step distance = 1 # skip choose worksheet step if there's only 1 worksheet if self.current_step == 'import_data' and self.sheets.length <= 1 distance = 2 end self.current_step = steps[steps.index(current_step) - distance] end |
#steps ⇒ Object
5 6 7 |
# File 'lib/importable/multi_step/import_helpers.rb', line 5 def steps %w[ upload_file choose_worksheet import_data ] end |