Module: JavaProperties::Encoding

Defined in:
lib/java_properties/data_types.rb

Class Method Summary collapse

Class Method Details

.decode(string) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/java_properties/data_types.rb', line 7

def decode(string)
  string = raw_decode(string)

  case string
  when /^:(\w+)$/
    Regexp.last_match[1].to_sym
  when /^(?:true|false)$/i
    string.downcase == "true"
  when /^\d+\ .+$/
    Unit(string)
  when /^\d+$/
    string.to_i
  when /^\d+\.\d+$/
    string.to_f
  when /^"(.*)"$/
    Regexp.last_match[1]
  else
    string
  end
end

.raw_decodeObject


6
# File 'lib/java_properties/data_types.rb', line 6

alias :raw_decode :decode