Sha256: 059ec7294f40bed543b8e2ba68c9fa542576e3f16424a0c427cefb09c5abba7d
Contents?: true
Size: 654 Bytes
Versions: 13
Compression:
Stored size: 654 Bytes
Contents
# frozen_string_literal: true require_relative 'base' module RubyVault module Options module Values class Boolean < Base def resolve return nil if @value.nil? return @value if a_boolean?(@value) return true if true_as_string?(@value) false end def render resolve.nil? ? nil : resolve.to_s end private def a_boolean?(value) value.is_a?(TrueClass) || value.is_a?(FalseClass) end def true_as_string?(value) value.respond_to?(:downcase) && value.downcase == 'true' end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems