Class: MetaCommit::Extension::RubySupport::Diffs::InitializeChanged

Inherits:
Diff
  • Object
show all
Defined in:
lib/meta_commit_ruby_support/diffs/initialize_changed.rb

Constant Summary

Constants inherited from Diff

Diff::SUPPORTED_PARSERS, Diff::TYPE_ADDITION, Diff::TYPE_DELETION, Diff::TYPE_REPLACE

Instance Attribute Summary

Attributes inherited from Diff

#commit_new, #commit_old, #diff_type, #new_ast_path, #new_file, #new_lineno, #old_ast_path, #old_file, #old_lineno

Instance Method Summary collapse

Methods inherited from Diff

#inspect, #is_in_context_of_class?, #is_in_context_of_method?, #is_in_context_of_module?, #is_name_of_class?, #is_name_of_module?, #name_of_context_class, #name_of_context_method, #name_of_context_module, #path_to_component, #supports_parser?, #to_s, #type_addition?, #type_deletion?, #type_replace?

Instance Method Details

#string_representationObject



10
11
12
# File 'lib/meta_commit_ruby_support/diffs/initialize_changed.rb', line 10

def string_representation
  "changes in initialization of #{path_to_component(new_ast_path, 0)}"
end

#supports_change(type, old_file_name, new_file_name, old_ast_path, new_ast_path) ⇒ Object



3
4
5
6
7
8
# File 'lib/meta_commit_ruby_support/diffs/initialize_changed.rb', line 3

def supports_change(type, old_file_name, new_file_name, old_ast_path, new_ast_path)
  type == MetaCommit::Extension::RubySupport::Diffs::Diff::TYPE_REPLACE &&
      !old_ast_path.target_node.empty_ast? && !new_ast_path.target_node.empty_ast? &&
      is_in_context_of_method?(old_ast_path) && is_in_context_of_method?(new_ast_path) &&
      name_of_context_method(old_ast_path) == 'initialize' && name_of_context_method(new_ast_path) == 'initialize'
end