Module: CucumberApi::Helpers
- Defined in:
- lib/cucumber-api/helpers.rb
Instance Method Summary collapse
-
#resolve(url) ⇒ String
Bind grabbed values into placeholders in given URL Ex: example.com?id=id with => 1 becomes example.com?id=1.
Instance Method Details
#resolve(url) ⇒ String
Bind grabbed values into placeholders in given URL Ex: example.com?id=id with => 1 becomes example.com?id=1
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cucumber-api/helpers.rb', line 7 def resolve url url.gsub!(/\{([a-zA-Z0-9_]+)\}/) do |s| s.gsub!(/[\{\}]/, '') if instance_variable_defined?("@#{s}") instance_variable_get("@#{s}") else raise 'Did you forget to "grab" ' + s + '?' end end url end |