Class: Tes::Request::RSpec::ProfileParser
- Inherits:
-
Object
- Object
- Tes::Request::RSpec::ProfileParser
- Includes:
- Function
- Defined in:
- lib/tes/request/rspec/profile_parser.rb
Instance Attribute Summary collapse
-
#profiles ⇒ Object
readonly
Returns the value of attribute profiles.
Instance Method Summary collapse
- #<<(spec_path) ⇒ Object
-
#initialize(spec_paths = []) ⇒ ProfileParser
constructor
A new instance of ProfileParser.
- #parse_profiles! ⇒ Object
Methods included from Function
#get_spec_path_info, #parse_spec_profile_lines
Constructor Details
#initialize(spec_paths = []) ⇒ ProfileParser
Returns a new instance of ProfileParser.
9 10 11 |
# File 'lib/tes/request/rspec/profile_parser.rb', line 9 def initialize(spec_paths=[]) @spec_paths = spec_paths end |
Instance Attribute Details
#profiles ⇒ Object (readonly)
Returns the value of attribute profiles.
13 14 15 |
# File 'lib/tes/request/rspec/profile_parser.rb', line 13 def profiles @profiles end |
Instance Method Details
#<<(spec_path) ⇒ Object
15 16 17 |
# File 'lib/tes/request/rspec/profile_parser.rb', line 15 def <<(spec_path) @spec_paths << spec_path end |
#parse_profiles! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/tes/request/rspec/profile_parser.rb', line 19 def parse_profiles! profile_map = {} @spec_paths.each do |s_p| spec_info = parse_spec(s_p) # 如果相同文件则进行合并 if profile_map.key?(spec_info[:file]) profile_map[spec_info[:file]] = merge_spec_info(profile_map[spec_info[:file]], spec_info) else profile_map[spec_info[:file]] = spec_info end end # 对存在的包含关系的ids尝试合并 profile_map.each do |_f, info| info[:ids] = merge_spec_ids(info[:ids]) if info[:ids] info[:locations].sort! if info[:locations] end @profiles = profile_map.values end |