Sha256: 3c761b39f24fb663f11bc4eba20a28c5f91ad1946e82f7d83e10dfbfc7263b6e
Contents?: true
Size: 643 Bytes
Versions: 9
Compression:
Stored size: 643 Bytes
Contents
# frozen_string_literal: true module Gurke class StepDefinition attr_reader :pattern, :opts def initialize(pattern, opts = {}) @pattern = pattern @opts = opts end def method_name "#{type.to_s.capitalize} #{pattern}" end def type opts[:type] || :any end 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 Match = Struct.new :method_name, :params end end
Version data entries
9 entries across 9 versions & 1 rubygems