Sha256: e81c48891d33bfe5a23b066272241140fe9533f58d6a5464990714ac26d15818
Contents?: true
Size: 406 Bytes
Versions: 10
Compression:
Stored size: 406 Bytes
Contents
require "json" class EasySettings::Coercion attr_reader :value def initialize(value) @value = value end 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 end
Version data entries
10 entries across 10 versions & 1 rubygems