Class: J2119::Deduce

Inherits:
Object
  • Object
show all
Defined in:
lib/j2119/deduce.rb

Class Method Summary collapse

Class Method Details

.value(val) ⇒ Object

we have to deduce the JSON value from they way they expressed it as

text in the J2119 file.


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/j2119/deduce.rb', line 21

def self.value(val)
  case val
  when /^"(.*)"$/
    $1
  when 'true'
    true
  when 'false'
    false
  when 'null'
    nil
  when /^\d+$/
    val.to_i
  else
    val.to_f
  end
    
end