Class: Hocon::ConfigRenderOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/hocon/config_render_options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin_comments, comments, formatted, json, key_value_separator = :equals) ⇒ ConfigRenderOptions

Returns a new instance of ConfigRenderOptions.



6
7
8
9
10
11
12
# File 'lib/hocon/config_render_options.rb', line 6

def initialize(origin_comments, comments, formatted, json, key_value_separator=:equals)
  @origin_comments = origin_comments
  @comments = comments
  @formatted = formatted
  @json = json
  @key_value_separator = key_value_separator
end

Instance Attribute Details

#commentsObject

Returns the value of attribute comments.



14
15
16
# File 'lib/hocon/config_render_options.rb', line 14

def comments
  @comments
end

#formattedObject

Returns the value of attribute formatted.



14
15
16
# File 'lib/hocon/config_render_options.rb', line 14

def formatted
  @formatted
end

#jsonObject

Returns the value of attribute json.



14
15
16
# File 'lib/hocon/config_render_options.rb', line 14

def json
  @json
end

#key_value_separatorObject

Returns the value of attribute key_value_separator.



14
15
16
# File 'lib/hocon/config_render_options.rb', line 14

def key_value_separator
  @key_value_separator
end

#origin_commentsObject

Returns the value of attribute origin_comments.



14
15
16
# File 'lib/hocon/config_render_options.rb', line 14

def origin_comments
  @origin_comments
end

Class Method Details

.conciseObject

Returns concise render options (no whitespace or comments). For a resolved Config, the concise rendering will be valid JSON.

Returns:

  • the concise render options



46
47
48
# File 'lib/hocon/config_render_options.rb', line 46

def self.concise
  Hocon::ConfigRenderOptions.new(false, false, false, true)
end

.defaultsObject

Returns the default render options which are verbose (commented and formatted). See ConfigRenderOptions#concise for stripped-down options. This rendering will not be valid JSON since it has comments.

Returns:

  • the default render options



36
37
38
# File 'lib/hocon/config_render_options.rb', line 36

def self.defaults
  Hocon::ConfigRenderOptions.new(true, true, true, true)
end

Instance Method Details

#comments?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/hocon/config_render_options.rb', line 19

def comments?
  @comments
end

#formatted?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/hocon/config_render_options.rb', line 22

def formatted?
  @formatted
end

#json?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/hocon/config_render_options.rb', line 25

def json?
  @json
end

#origin_comments?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/hocon/config_render_options.rb', line 16

def origin_comments?
  @origin_comments
end