Sha256: 0e307459beb7731847a88573832c1509700f6021257c88b774551abe243893e7
Contents?: true
Size: 1012 Bytes
Versions: 14
Compression:
Stored size: 1012 Bytes
Contents
require 'fedux_org/stdlib/logic_converters/exceptions' module FeduxOrg module Stdlib module LogicConverters class YesNoConverter # @param [true,false] value # the logic value which should be converted # @return [String] # the converted value: true => yes, false => no, '' => nil # # @example Parse true # converter = FeduxOrg::Stdlib::LogicConverters::OnOffConverter.new # converter.parse( true ) # 'yes' # # @example Parse false # converter = FeduxOrg::Stdlib::LogicConverters::OnOffConverter.new # converter.parse( false ) # 'no' # def parse( value ) case value when true 'yes' when false 'no' when '' nil else raise FeduxOrg::Stdlib::LogicConverters::Exceptions::InvalidValue, "Unknown logic value \"#{value}\"." end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems