class Gauge::MethodCache
@api private
Public Class Methods
Source
# File lib/method_cache.rb, line 28 def self.add_step(step_value, step_info) if @@steps_map.key? step_value @@steps_map[step_value][:locations].push(step_info[:location]) else @@steps_map[step_value] = { locations: [step_info[:location]], block: step_info[:block], step_text: step_info[:step_text], recoverable: step_info[:recoverable] } end end
Source
# File lib/method_cache.rb, line 50 def self.add_step_alias(*step_texts) @@steps_with_aliases.push *step_texts if step_texts.length > 1 end
Source
# File lib/method_cache.rb, line 62 def self.all_steps @@steps_map.values.map { |si| si[:step_text] } end
Source
# File lib/method_cache.rb, line 20 def self.clear_hooks(hook) class_variable_get("@@#{hook}_hooks").clear end
Source
# File lib/method_cache.rb, line 41 def self.get_step_info(step_value) @@steps_map[step_value] end
Source
# File lib/method_cache.rb, line 46 def self.get_step_text(step_value) @@steps_map[step_value][:step_text] end
Source
# File lib/method_cache.rb, line 54 def self.has_alias?(step_text) @@steps_with_aliases.include? step_text end
Source
# File lib/method_cache.rb, line 83 def self.is_file_cached(file) @@steps_map.each_pair do |step, info| if info[:locations].any? { |loc| relative_filepath(loc[:file]).eql? relative_filepath(file) } return true end end return false end
Source
# File lib/method_cache.rb, line 92 def self.multiple_implementation?(step_value) @@steps_map[step_value][:locations].length > 1 end
Source
# File lib/method_cache.rb, line 66 def self.recoverable?(step_value) @@steps_map[step_value][:recoverable] end
Source
# File lib/method_cache.rb, line 70 def self.relative_filepath(file) project_root = Pathname.new(ENV['GAUGE_PROJECT_ROOT']) filename = Pathname.new(file).relative_path_from(project_root) return project_root.join(filename.to_s.split(":").first) end
Source
# File lib/method_cache.rb, line 76 def self.remove_steps(file) @@steps_map.each_pair do |step, info| l = info[:locations].reject { |loc| relative_filepath(loc[:file]).eql? relative_filepath(file) } l.empty? ? @@steps_map.delete(step) : @@steps_map[step][:locations] = l end end
Source
# File lib/method_cache.rb, line 96 def self.step_positions(file) step_positions = [] @@steps_map.each_pair do |step, info| info[:locations].each do |location| if location[:file] == file step_positions.push({stepValue: step, span: location[:span]}) end end end step_positions end
Source
# File lib/method_cache.rb, line 58 def self.valid_step?(step) @@steps_map.key? step end