Class: Hocon::Impl::ConfigNumber
Constant Summary
AbstractConfigValue::ConfigBugOrBrokenError, AbstractConfigValue::ConfigImplUtil, AbstractConfigValue::ResolveStatus
Instance Attribute Summary collapse
#origin
Class Method Summary
collapse
Instance Method Summary
collapse
#at_key, #at_key_with_origin, #at_path, #at_path_with_origin, #construct_delayed_merge, #delay_merge, has_descendant_in_list?, #ignores_fallbacks?, indent, #inspect, #merged_stack_with_non_object, #merged_stack_with_object, #merged_stack_with_the_unmergeable, #merged_with_non_object, #merged_with_object, #merged_with_the_unmergeable, #new_copy, #relativized, #render, #render_to_sb, #render_value_to_sb, replace_child_in_list, #require_not_ignoring_fallbacks, #resolve_status, #resolve_substitutions, #to_fallback_value, #to_s, #with_fallback, #with_fallbacks_ignored, #with_origin
#at_key, #at_path, #origin, #render, #unwrapped, #value_type, #with_fallback, #with_origin
#with_fallback
Constructor Details
#initialize(origin, original_text) ⇒ ConfigNumber
Returns a new instance of ConfigNumber.
22
23
24
25
|
# File 'lib/hocon/impl/config_number.rb', line 22
def initialize(origin, original_text)
super(origin)
@original_text = original_text
end
|
Instance Attribute Details
#original_text ⇒ Object
Returns the value of attribute original_text.
26
27
28
|
# File 'lib/hocon/impl/config_number.rb', line 26
def original_text
@original_text
end
|
Class Method Details
.new_number(origin, number, original_text) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/hocon/impl/config_number.rb', line 13
def self.new_number(origin, number, original_text)
as_int = number.to_i
if as_int == number
Hocon::Impl::ConfigInt.new(origin, as_int, original_text)
else
Hocon::Impl::ConfigDouble.new(origin, number, original_text)
end
end
|
Instance Method Details
#==(other) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/hocon/impl/config_number.rb', line 46
def ==(other)
if other.is_a?(Hocon::Impl::ConfigNumber) && can_equal(other)
@value == other.value
else
false
end
end
|
#can_equal(other) ⇒ Object
42
43
44
|
# File 'lib/hocon/impl/config_number.rb', line 42
def can_equal(other)
other.is_a?(Hocon::Impl::ConfigNumber)
end
|
#hash ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/hocon/impl/config_number.rb', line 54
def hash
to_int = @value.round
if to_int == @value
to_int.hash
else
@value.hash
end
end
|
#int_value_range_checked(path) ⇒ Object
32
33
34
35
36
|
# File 'lib/hocon/impl/config_number.rb', line 32
def int_value_range_checked(path)
long_value
end
|
#long_value ⇒ Object
38
39
40
|
# File 'lib/hocon/impl/config_number.rb', line 38
def long_value
raise "long_value needs to be overriden by sub-classes of #{Hocon::Impl::ConfigNumber}, in this case #{self.class}"
end
|
28
29
30
|
# File 'lib/hocon/impl/config_number.rb', line 28
def transform_to_string
@original_text
end
|