Class: BlueprintConfig::Setting

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/blueprint_config/setting.rb

Instance Method Summary collapse

Instance Method Details

#parsed_json_valueObject



11
12
13
14
15
16
17
18
# File 'lib/blueprint_config/setting.rb', line 11

def parsed_json_value
  parsed = begin
    JSON.parse(value)
  rescue StandardError
    nil
  end
  parsed.is_a?(Hash) ? parsed.with_indifferent_access : parsed
end

#parsed_valueObject



20
21
22
23
24
25
26
# File 'lib/blueprint_config/setting.rb', line 20

def parsed_value
  return value.to_i if integer?
  return value.to_b if boolean?
  return parsed_json_value if json? || set?

  value
end