Class: Hiptest::DefaultArgumentAdder
- Inherits:
-
Object
- Object
- Hiptest::DefaultArgumentAdder
- Defined in:
- lib/hiptest-publisher/call_arguments_adder.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project) ⇒ DefaultArgumentAdder
constructor
A new instance of DefaultArgumentAdder.
- #update_calls ⇒ Object
Constructor Details
#initialize(project) ⇒ DefaultArgumentAdder
Returns a new instance of DefaultArgumentAdder.
10 11 12 13 |
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 10 def initialize(project) @project = project @indexer = ActionwordIndexer.new(project) end |
Class Method Details
.add(project) ⇒ Object
6 7 8 |
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 6 def self.add(project) DefaultArgumentAdder.new(project).update_calls end |
Instance Method Details
#update_calls ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hiptest-publisher/call_arguments_adder.rb', line 15 def update_calls @project.each_sub_nodes(Hiptest::Nodes::Call) do |call| aw_data = @indexer.get_index(call.children[:actionword]) next if aw_data.nil? arguments = {} call.children[:arguments].each do |arg| arguments[arg.children[:name]] = arg.children[:value] end call.children[:all_arguments] = aw_data[:parameters].map do |p_name, default_value| Hiptest::Nodes::Argument.new( p_name, arguments.has_key?(p_name) ? arguments[p_name] : default_value ) end end end |