6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/wizardry/base.rb', line 6
def wizardry(*steps)
class_attribute :steps, :steps_regexp, instance_writer: false
self.steps = steps.map{ |s| s.to_s.inquiry }
self.steps_regexp = Regexp.new(steps.join('|'))
include WizardryMethods
[*Wizardry::ORDINALS.first(steps.size - 1), :last].each do |method|
class_eval " def \#{method}_step # def first_step\n steps.\#{method} # steps.first\n end # end\n\n def \#{method}_step? # def first_step?\n current_step == \#{method}_step # current_step == first_step\n end # end\n EOT\n end\nend\n", __FILE__, __LINE__ + 1
|