Method: Gurke::DSL#_define_step

Defined in:
lib/gurke/dsl.rb

#_define_step(pattern, method_name, opts, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gurke/dsl.rb', line 20

def _define_step(pattern, method_name, opts, &block)
  step = StepDefinition.new(pattern, opts)

  define_method("match: #{step.method_name}") do |name, s = nil|
    step.match(name, s)
  end

  if block_given?
    define_method(step.method_name.to_s, &block)
  elsif method_name
    alias_method step.method_name.to_s, method_name
  end
end