File: config_render_options.rb

package info (click to toggle)
ruby-hocon 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ruby: 7,903; makefile: 4
file content (49 lines) | stat: -rw-r--r-- 1,212 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# encoding: utf-8

require_relative '../hocon'

class Hocon::ConfigRenderOptions
  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

  attr_accessor :origin_comments, :comments, :formatted, :json, :key_value_separator

  def origin_comments?
    @origin_comments
  end
  def comments?
    @comments
  end
  def formatted?
    @formatted
  end
  def json?
    @json
  end

  #
  # Returns the default render options which are verbose (commented and
  # formatted). See {@link ConfigRenderOptions#concise} for stripped-down
  # options. This rendering will not be valid JSON since it has comments.
  #
  # @return the default render options
  #
  def self.defaults
    Hocon::ConfigRenderOptions.new(true, true, true, true)
  end

  #
  # Returns concise render options (no whitespace or comments). For a
  # resolved {@link Config}, the concise rendering will be valid JSON.
  #
  # @return the concise render options
  #
  def self.concise
    Hocon::ConfigRenderOptions.new(false, false, false, true)
  end
end