Module: Cucumber::UsualSuspects::Api

Included in:
Cucumber::UsualSuspects
Defined in:
lib/cucumber/usual_suspects/api.rb

Instance Method Summary collapse

Instance Method Details

#expand(regexp) ⇒ Object

expands the given regular expression according to any identities that have been remembered



13
14
15
16
17
18
19
# File 'lib/cucumber/usual_suspects/api.rb', line 13

def expand(regexp)
  result = regexp.to_s
  identities.each do |id|
    result.gsub!("<#{id}>", "(#{id.regexp_string})")
  end
  Regexp.new result
end

#remember(description, definition) ⇒ Object



21
22
23
# File 'lib/cucumber/usual_suspects/api.rb', line 21

def remember(description, definition)
  identities << Identity.new(@transforms_registry, description, definition)
end

#transforms_registry=(value) ⇒ Object

this tells UsualSuspects how to send Transforms to Cucumber



7
8
9
# File 'lib/cucumber/usual_suspects/api.rb', line 7

def transforms_registry=(value)
  @transforms_registry = value
end