class Gurke::StepDefinition

Constants

Match

Attributes

opts[R]
pattern[R]

Public Class Methods

new(pattern, opts = {}) click to toggle source
# File lib/gurke/step_definition.rb, line 7
def initialize(pattern, opts = {})
  @pattern      = pattern
  @opts         = opts
end

Public Instance Methods

match(name, type = :any) click to toggle source
# File lib/gurke/step_definition.rb, line 20
def match(name, type = :any)
  return if self.type != :any && self.type != type
  return if pattern.is_a?(String) && name != pattern
  match = pattern.match(name)

  return unless match

  Match.new method_name, match.to_a[1..-1]
end
method_name() click to toggle source
# File lib/gurke/step_definition.rb, line 12
def method_name
  "#{type.to_s.capitalize} #{pattern}"
end
type() click to toggle source
# File lib/gurke/step_definition.rb, line 16
def type
  opts[:type] || :any
end