Sha256: b96329bbe0008d5485fef53b81b8c933b52c764ea8cad20dd88902dd026db912
Contents?: true
Size: 960 Bytes
Versions: 64
Compression:
Stored size: 960 Bytes
Contents
# encoding: utf-8 require 'fedux_org_stdlib/logic_converters/exceptions' module FeduxOrgStdlib module LogicConverters class TrueFalseConverter # @param [true,false] value # the logic value which should be converted # @return [String] # the converted value: true => 'true', false => 'false', '' => nil # # @example Parse true # converter = FeduxOrgStdlib::LogicConverters::OnOffConverter.new # converter.parse( true ) # 'true' # # @example Parse false # converter = FeduxOrgStdlib::LogicConverters::OnOffConverter.new # converter.parse( false ) # 'false' def parse( value ) case value when true 'true' when false 'false' when '' nil else raise FeduxOrgStdlib::LogicConverters::Exceptions::InvalidValue, "Unknown logic value \"#{value}\"." end end end end end
Version data entries
64 entries across 64 versions & 1 rubygems