Class: MetaCommit::Extension::MarkdownSupport::Diffs::Diff

Inherits:
Contracts::Diff
  • Object
show all
Includes:
ContextualAstAccessor
Defined in:
lib/meta_commit_markdown_support/diffs/diff.rb

Constant Summary collapse

SUPPORTED_PARSERS =
[MetaCommit::Extension::MarkdownSupport::Parsers::Markdown]

Constants included from ContextualAstAccessor

ContextualAstAccessor::ELEMENT_TYPE_ANCHOR, ContextualAstAccessor::ELEMENT_TYPE_CODE, ContextualAstAccessor::ELEMENT_TYPE_HEADER, ContextualAstAccessor::ELEMENT_TYPE_IMAGE, ContextualAstAccessor::ELEMENT_TYPE_LISTS, ContextualAstAccessor::ELEMENT_TYPE_LIST_ITEM, ContextualAstAccessor::ELEMENT_TYPE_PARAGRAPH, ContextualAstAccessor::ELEMENT_TYPE_TEXT

Instance Method Summary collapse

Methods included from ContextualAstAccessor

#anchor?, #anchor_context?, #anchor_target, #anchor_title, #closest_header_of_list, #code?, #code_context?, #code_first_line, #context_node_neighbours, #context_nodes_on_line, #contextual_ast_has_target_node, #element_closest_to, #elements_of_type_on_line, #header?, #header_content, #image?, #list?, #list_context?, #list_item?, #nested_list_context?, #paragraph?, #paragraph_context?, #parent_list_item_title, #starts_on_line?, #string_content, #text?, #text_context?

Instance Method Details

#inspectString

Returns:

  • (String)


21
22
23
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 21

def inspect
  string_representation
end

#string_representationString

Returns:

  • (String)


31
32
33
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 31

def string_representation
  "perform #{change_context.type}"
end

#supports_change(context) ⇒ Boolean

Parameters:

  • context (MetaCommit::Contracts::ChangeContext)

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 15

def supports_change(context)
  # TODO Set to false
  true
end

#supports_parser?(parser) ⇒ Boolean

Parameters:

  • parser (Class)

Returns:

  • (Boolean)


9
10
11
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 9

def supports_parser?(parser)
  SUPPORTED_PARSERS.include?(parser)
end

#to_sString

Returns:

  • (String)


26
27
28
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 26

def to_s
  string_representation
end

#type_addition?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 36

def type_addition?
  change_context.type == TYPE_ADDITION
end

#type_deletion?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 41

def type_deletion?
  change_context.type == TYPE_DELETION
end

#type_replace?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/meta_commit_markdown_support/diffs/diff.rb', line 46

def type_replace?
  change_context.type == TYPE_REPLACE
end