Class: SuperDiff::DiffFormatters::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/diff_formatters/collection.rb

Constant Summary collapse

ICONS =
{ delete: "-", insert: "+" }.freeze
STYLES =
{ insert: :inserted, delete: :deleted, noop: :normal }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(open_token:, close_token:, operations:, indent_level:, add_comma:, collection_prefix:, build_item_prefix:) ⇒ Collection

Returns a new instance of Collection.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/super_diff/diff_formatters/collection.rb', line 11

def initialize(
  open_token:,
  close_token:,
  operations:,
  indent_level:,
  add_comma:,
  collection_prefix:,
  build_item_prefix:
)
  @open_token = open_token
  @close_token = close_token
  @operations = operations
  @indent_level = indent_level
  @add_comma = add_comma
  @collection_prefix = collection_prefix
  @build_item_prefix = build_item_prefix
end

Class Method Details

.call(*args, &block) ⇒ Object



7
8
9
# File 'lib/super_diff/diff_formatters/collection.rb', line 7

def self.call(*args, &block)
  new(*args, &block).call
end

Instance Method Details

#callObject



29
30
31
# File 'lib/super_diff/diff_formatters/collection.rb', line 29

def call
  lines.join("\n")
end