Class: Hocon::Impl::SimpleConfigList
Constant Summary
collapse
- ResolveStatus =
Hocon::Impl::ResolveStatus
AbstractConfigValue::ConfigImplUtil
Instance Attribute Summary
#origin
Instance Method Summary
collapse
#ignores_fallbacks?, #indent, #render, #render_to_sb, #require_not_ignoring_fallbacks, #resolve_status, #to_s, #with_fallback, #with_origin
Constructor Details
#initialize(origin, value, status = ResolveStatus.from_values(value)) ⇒ SimpleConfigList
Returns a new instance of SimpleConfigList.
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/hocon/impl/simple_config_list.rb', line 8
def initialize(origin, value, status = ResolveStatus.from_values(value))
super(origin)
@value = value
@resolved = (status == ResolveStatus::RESOLVED)
if status != ResolveStatus.from_values(value)
raise ConfigBugError, "SimpleConfigList created with wrong resolve status: #{self}"
end
end
|
Instance Method Details
#new_copy(origin) ⇒ Object
#render_value_to_sb(sb, indent_size, at_root, options) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/hocon/impl/simple_config_list.rb', line 27
def render_value_to_sb(sb, indent_size, at_root, options)
if @value.empty?
sb << "[]"
else
sb << "["
if options.formatted?
sb << "\n"
end
@value.each do |v|
if options.
indent(sb, indent_size + 1, options)
sb << "# "
sb << v.origin.description
sb << "\n"
end
if options.
v.origin..each do ||
sb << "# "
sb <<
sb << "\n"
end
end
indent(sb, indent_size + 1, options)
v.render_value_to_sb(sb, indent_size + 1, at_root, options)
sb << ","
if options.formatted?
sb << "\n"
end
end
sb.pos = sb.pos - 1 if options.formatted?
sb.pos = sb.pos - 1 sb << "\n"
indent(sb, indent_size, options)
end
sb << "]"
end
end
|
#unwrapped ⇒ Object
23
24
25
|
# File 'lib/hocon/impl/simple_config_list.rb', line 23
def unwrapped
@value.map { |v| v.unwrapped }
end
|