class EasySettings::Coercion
Attributes
value[R]
Public Class Methods
new(value)
click to toggle source
# File lib/easy-settings/coercion.rb, line 6 def initialize(value) @value = value end
Public Instance Methods
run()
click to toggle source
# File lib/easy-settings/coercion.rb, line 10 def run case value when "false" false when "true" true when /^json:/ JSON.parse(value.gsub(/^json:/, "")) when /^\+/ # don't treat +41791234567 as a number value else Integer(value) rescue Float(value) rescue value end end