File: config_value_type.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 (29 lines) | stat: -rw-r--r-- 688 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
# encoding: utf-8

require_relative '../hocon'
require_relative '../hocon/config_error'

#
# The type of a configuration value (following the <a
# href="http://json.org">JSON</a> type schema).
#
module Hocon::ConfigValueType
  OBJECT = 0
  LIST = 1
  NUMBER = 2
  BOOLEAN = 3
  NULL = 4
  STRING = 5

  def self.value_type_name(config_value_type)
    case config_value_type
      when OBJECT then "OBJECT"
      when LIST then "LIST"
      when NUMBER then "NUMBER"
      when BOOLEAN then "BOOLEAN"
      when NULL then "NULL"
      when STRING then "STRING"
      else raise Hocon::ConfigError::ConfigBugOrBrokenError, "Unrecognized value type '#{config_value_type}'"
    end
  end
end