Sha256: 48fb27d379f26603c027a152fab77bc0203bf45cad7032c13221443240863f24
Contents?: true
Size: 1.27 KB
Versions: 6
Compression:
Stored size: 1.27 KB
Contents
require 'fedux_org/stdlib/logic_converters/exceptions' require 'fedux_org/stdlib/logic_converters/on_off_converter' require 'fedux_org/stdlib/logic_converters/true_false_converter' require 'fedux_org/stdlib/logic_converters/yes_no_converter' module FeduxOrg module Stdlib module LogicConverters class LogicConverter # @param [String, Symbol] type (true_false, yes_no, on_off) # choose the type of converter which should be used def initialize(type) @converter = case type.to_s when 'true_false' YesNoConverter.new when 'yes_no' TrueFalseConverter.new when 'on_off' OnOffConverter.new else raise FeduxOrg::Stdlib::LogicConverters::Exceptions::InvalidType, "Unknown type \"#{type}\" for logic converter. Valid types are \"true_false\", \"yes_no\" or \"on_off\"." end end # @param [true,false] value # the logic value which should be converted # @return [String] # the converted value def parse( value ) @converter.parse( value ) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems