Module: Jade::ModuleLoader::Normalize

Extended by:
Normalize
Included in:
Normalize
Defined in:
lib/jade/module_loader/normalize.rb

Overview

Strips source positions from a nested Data tree so equivalent shapes produce equal byte sequences. Used to compute interface digests that survive whitespace and unrelated edits.

Constant Summary collapse

POSITION_FIELDS =
%i[decl_span span range origin].freeze

Instance Method Summary collapse

Instance Method Details

#apply(value) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/jade/module_loader/normalize.rb', line 13

def apply(value)
  case value
  when Data  then normalize_data(value)
  when Hash  then value.transform_values { apply(it) }
  when Array then value.map { apply(it) }
  when Set   then value.map { apply(it) }.to_set
  else value
  end
end