Class: MetaCommit::Extension::RubySupport::Diffs::ChangesInMethod

Inherits:
Diff
  • Object
show all
Defined in:
lib/meta_commit_ruby_support/diffs/changes_in_method.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



7
8
9
10
11
12
# File 'lib/meta_commit_ruby_support/diffs/changes_in_method.rb', line 7

def string_representation
  if is_in_context_of_class?(@new_ast_path)
    return "changes in #{name_of_context_class(new_ast_path)}##{name_of_context_method(new_ast_path)}"
  end
  "changes in ##{name_of_context_method(new_ast_path)}"
end

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



3
4
5
# File 'lib/meta_commit_ruby_support/diffs/changes_in_method.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)
end