Sha256: 27487fcc6e777a8b60b8b63cef04b7802e674bf930a541bda9e97d1844c7320c

Contents?: true

Size: 670 Bytes

Versions: 8

Compression:

Stored size: 670 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
        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

8 entries across 8 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.0.31 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.30 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.29 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.28 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.26 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.25 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.24 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb
fedux_org-stdlib-0.0.23 lib/fedux_org/stdlib/logic_converters/yes_no_converter.rb