Class: Canon::Config::PrettyPrinterConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/canon/config.rb

Overview

Pretty-printer sub-configuration for display canonicalization. Controls how documents are formatted by Canon::PrettyPrinter::Xml when display_preprocessing: :pretty_print is active. The two attributes (indent and indent_type) are backed by the parent DiffConfig‘s resolver so that ENV overrides (e.g. CANON_XML_DIFF_PRETTY_PRINTER_INDENT) work automatically.

Instance Method Summary collapse

Constructor Details

#initialize(resolver) ⇒ PrettyPrinterConfig

Returns a new instance of PrettyPrinterConfig.



277
278
279
# File 'lib/canon/config.rb', line 277

def initialize(resolver)
  @resolver = resolver
end

Instance Method Details

#indentObject



281
282
283
# File 'lib/canon/config.rb', line 281

def indent
  @resolver.resolve(:pretty_printer_indent)
end

#indent=(value) ⇒ Object



285
286
287
# File 'lib/canon/config.rb', line 285

def indent=(value)
  @resolver.set_programmatic(:pretty_printer_indent, value)
end

#indent_typeObject



289
290
291
# File 'lib/canon/config.rb', line 289

def indent_type
  @resolver.resolve(:pretty_printer_indent_type)
end

#indent_type=(value) ⇒ Object



293
294
295
296
# File 'lib/canon/config.rb', line 293

def indent_type=(value)
  DiffConfig.validate_config_value!(:pretty_printer_indent_type, value)
  @resolver.set_programmatic(:pretty_printer_indent_type, value)
end