Class: Hocon::Impl::ResolveResult

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

Overview

value is allowed to be null

Constant Summary collapse

ConfigBugOrBrokenError =
Hocon::ConfigError::ConfigBugOrBrokenError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, value) ⇒ ResolveResult

Returns a new instance of ResolveResult.



12
13
14
15
# File 'lib/hocon/impl/resolve_result.rb', line 12

def initialize(context, value)
  @context = context
  @value = value
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



10
11
12
# File 'lib/hocon/impl/resolve_result.rb', line 10

def context
  @context
end

#valueObject

Returns the value of attribute value.



10
11
12
# File 'lib/hocon/impl/resolve_result.rb', line 10

def value
  @value
end

Class Method Details

.make(context, value) ⇒ Object



17
18
19
# File 'lib/hocon/impl/resolve_result.rb', line 17

def self.make(context, value)
  self.new(context, value)
end

Instance Method Details

#as_object_resultObject



21
22
23
24
25
26
# File 'lib/hocon/impl/resolve_result.rb', line 21

def as_object_result
  unless @value.is_a?(Hocon::Impl::AbstractConfigObject)
    raise ConfigBugOrBrokenError.new("Expecting a resolve result to be an object, but it was #{@value}")
  end
  self
end

#as_value_resultObject



28
29
30
# File 'lib/hocon/impl/resolve_result.rb', line 28

def as_value_result
  self
end

#pop_traceObject



32
33
34
# File 'lib/hocon/impl/resolve_result.rb', line 32

def pop_trace
  self.class.make(@context.pop_trace, value)
end

#to_sObject



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

def to_s
  "ResolveResult(#{@value})"
end