Class: OpenAPISourceTools::OutputConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi/sourcetools/output.rb

Overview

Output configuration settings for easy storage. You can have it in configuration and pass hash to initialize.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cfg = {}) ⇒ OutputConfiguration

Returns a new instance of OutputConfiguration.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/openapi/sourcetools/output.rb', line 17

def initialize(cfg = {})
  @indent_character = cfg['indent_character'] || ' '
  @indent_step = cfg['indent_step'] || 4
  @tab = cfg['tab'] || "\t"
  @tab_replaces_count = cfg['tab_replaces_count'] || 0
  @prettified_json = {
    array_nl: "\n",
    object_nl: "\n",
    indent: '  ',
    space: ' '
  }.merge(cfg['prettified_json'] || {})
end

Instance Attribute Details

#indent_characterObject (readonly)

Returns the value of attribute indent_character.



14
15
16
# File 'lib/openapi/sourcetools/output.rb', line 14

def indent_character
  @indent_character
end

#indent_stepObject (readonly)

Returns the value of attribute indent_step.



14
15
16
# File 'lib/openapi/sourcetools/output.rb', line 14

def indent_step
  @indent_step
end

#prettified_jsonObject (readonly)

Returns the value of attribute prettified_json.



15
16
17
# File 'lib/openapi/sourcetools/output.rb', line 15

def prettified_json
  @prettified_json
end

#tabObject (readonly)

Returns the value of attribute tab.



15
16
17
# File 'lib/openapi/sourcetools/output.rb', line 15

def tab
  @tab
end

#tab_replaces_countObject (readonly)

Returns the value of attribute tab_replaces_count.



15
16
17
# File 'lib/openapi/sourcetools/output.rb', line 15

def tab_replaces_count
  @tab_replaces_count
end