Sha256: a1d0d46c60b313992684380b193405ca02b6b92d590b3eb1cb4b9158f7f63428

Contents?: true

Size: 438 Bytes

Versions: 3

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module Mitake
  # The helper object to define boolean value
  #
  # @since 0.1.0
  # @api private
  class Boolean
    TRUE_VALUES = %w[Y 1 yes true].freeze

    class << self
      # Parse boolean value
      #
      # @since 0.1.0
      # @api private
      def parse(value)
        return true if value == true
        return true if TRUE_VALUES.include?(value)

        false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mitake-0.1.2 lib/mitake/boolean.rb
mitake-0.1.1 lib/mitake/boolean.rb
mitake-0.1.0 lib/mitake/boolean.rb