Class: Gauge::Util
- Inherits:
-
Object
- Object
- Gauge::Util
- Defined in:
- lib/util.rb
Class Method Summary collapse
- .get_file_name(prefix = "", counter = 0) ⇒ Object
- .get_param_name(params, index) ⇒ Object
- .get_step_implementation_dir ⇒ Object
- .step_value(text) ⇒ Object
- .unique_screenshot_file ⇒ Object
Class Method Details
.get_file_name(prefix = "", counter = 0) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/util.rb', line 31 def get_file_name(prefix = "", counter = 0) name = "step_implementation#{prefix}.rb" file_name = File.join(get_step_implementation_dir, name) return file_name unless File.file? file_name counter += 1 get_file_name("_#{counter}", counter) end |
.get_param_name(params, index) ⇒ Object
21 22 23 24 25 |
# File 'lib/util.rb', line 21 def get_param_name(params, index) name = "arg_#{index}" return name unless params.include? name get_param_name(params, index + 1) end |
.get_step_implementation_dir ⇒ Object
27 28 29 |
# File 'lib/util.rb', line 27 def get_step_implementation_dir return File.join(ENV["GAUGE_PROJECT_ROOT"].gsub(/\\/, "/"), "step_implementations") end |
.step_value(text) ⇒ Object
39 40 41 |
# File 'lib/util.rb', line 39 def step_value(text) text.gsub(/(<.*?>)/, "{}") end |
.unique_screenshot_file ⇒ Object
42 43 44 45 |
# File 'lib/util.rb', line 42 def unique_screenshot_file base_name = "screenshot-#{Process.pid}-#{(Time.now.to_f*10000).to_i}.png" File.join(ENV['gauge_screenshots_dir'],base_name) end |