Class: SuperDiff::DiffFormatters::Hash
- Inherits:
-
Base
- Object
- Base
- SuperDiff::DiffFormatters::Hash
show all
- Defined in:
- lib/super_diff/diff_formatters/hash.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
call, #initialize
Class Method Details
.applies_to?(operations) ⇒ Boolean
4
5
6
|
# File 'lib/super_diff/diff_formatters/hash.rb', line 4
def self.applies_to?(operations)
operations.is_a?(OperationSequences::Hash)
end
|
Instance Method Details
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/super_diff/diff_formatters/hash.rb', line 8
def call
Collection.call(
open_token: "{",
close_token: "}",
collection_prefix: collection_prefix,
build_item_prefix: -> (operation) {
key =
if operation.respond_to?(:left_key)
operation.left_key
else
operation.key
end
if key.is_a?(Symbol)
"#{key}: "
else
"#{key.inspect} => "
end
},
operations: operations,
indent_level: indent_level,
add_comma: add_comma?,
)
end
|