Sha256: d78b7563d7187f269fbdf8af04d2f2350c057d7c6998607f7e1bfe9f51215378
Contents?: true
Size: 676 Bytes
Versions: 12
Compression:
Stored size: 676 Bytes
Contents
# frozen_string_literal: true module HoneyFormat # Converts decimal or nil ConvertDecimal = proc do |v| begin Float(v) rescue ArgumentError, TypeError nil end end # Converts to decimal or zero ConvertDecimalOrZero = proc { |v| v.to_f } # Convert to integer or nil ConvertInteger = proc do |v| begin Integer(v) rescue ArgumentError, TypeError nil end end # Convert to integer or zero ConvertIntegerOrZero = proc { |v| v.to_i } # Convert to decimal or raise error StrictConvertDecimal = proc { |v| Float(v) } # Convert to integer or raise error StrictConvertInteger = proc { |v| Integer(v) } end
Version data entries
12 entries across 12 versions & 1 rubygems