Sha256: dddbc3d1e22efbe0a3c2aa24c9fa318166e8c6ce050158eb33eb289d0f5df373
Contents?: true
Size: 1.35 KB
Versions: 64
Compression:
Stored size: 1.35 KB
Contents
# encoding: utf-8 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' require 'fedux_org_stdlib/logic_converters/y_n_converter' module FeduxOrgStdlib 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' TrueFalseConverter.new when 'yes_no' YesNoConverter.new when 'on_off' OnOffConverter.new when 'y_n' YNConverter.new else raise FeduxOrgStdlib::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
Version data entries
64 entries across 64 versions & 1 rubygems