Class: AppDatum

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/pig-media-server/model/data_use_rdb.rb

Instance Method Summary collapse

Instance Method Details

#parseObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/pig-media-server/model/data_use_rdb.rb', line 39

def parse
  val = self.value
  case val
  when 'true'
    true
  when 'false'
    false
  else
    JSON.parse val
  end

rescue
  if val.class == String
    val.gsub(/^"|"$/, '')
  else
    val
  end
end