Class: MetaCommit::Extension::RubySupport::Diffs::ClassCreation
- Inherits:
-
Diff
- Object
- Contracts::Diff
- Diff
- MetaCommit::Extension::RubySupport::Diffs::ClassCreation
- Defined in:
- lib/meta_commit_ruby_support/diffs/class_creation.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
- #string_representation ⇒ Object
- #supports_change(type, old_file_name, new_file_name, old_ast_path, new_ast_path) ⇒ Object
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_representation ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/meta_commit_ruby_support/diffs/class_creation.rb', line 7 def string_representation if @new_ast_path.target_node.is_class? if is_in_context_of_module?(@new_ast_path) return "created #{name_of_context_module(new_ast_path)}::#{new_ast_path.target_node.class_name}" end return "created class #{new_ast_path.class_name}" end if is_in_context_of_module?(@new_ast_path) return "created #{name_of_context_module(new_ast_path)}::#{name_of_context_class(new_ast_path)}" end "created class #{name_of_context_class(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/class_creation.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_ADDITION && !new_ast_path.target_node.empty_ast? && (new_ast_path.target_node.is_class? || is_name_of_class?(new_ast_path)) end |