Module: Steppy::ClassMethods
- Defined in:
- lib/steppy.rb
Overview
Steppy class methods that will be added to your included classes.
Instance Method Summary collapse
- #step(method, **args, &block) ⇒ Object
- #step_if(condition, &block) ⇒ Object
- #step_set(*sets) ⇒ Object
- #steppy(&block) ⇒ Object
- #steppy_add(step) ⇒ Object
- #steppy_cache ⇒ Object
- #steppy_steps ⇒ Object
Instance Method Details
#step(method, **args, &block) ⇒ Object
16 17 18 19 |
# File 'lib/steppy.rb', line 16 def step(method, **args, &block) args[:prefix] ||= :step steppy_add step_method: method, step_args: args, step_block: block end |
#step_if(condition, &block) ⇒ Object
23 24 25 |
# File 'lib/steppy.rb', line 23 def step_if(condition, &block) steppy_add step_if: condition, step_block: block end |
#step_set(*sets) ⇒ Object
29 30 31 |
# File 'lib/steppy.rb', line 29 def step_set(*sets) steppy_cache[:sets] = *sets end |
#steppy(&block) ⇒ Object
47 48 49 |
# File 'lib/steppy.rb', line 47 def steppy(&block) steppy_cache[:block] = block end |
#steppy_add(step) ⇒ Object
42 43 44 45 |
# File 'lib/steppy.rb', line 42 def steppy_add(step) steppy_steps.push(step) steppy_cache end |
#steppy_cache ⇒ Object
34 35 36 |
# File 'lib/steppy.rb', line 34 def steppy_cache @steppy_cache ||= SteppyCache.new(steps: nil, sets: [], block: nil) end |
#steppy_steps ⇒ Object
38 39 40 |
# File 'lib/steppy.rb', line 38 def steppy_steps steppy_cache[:steps] ||= [] end |