Sha256: a329392328f2567e13df0b5cf26fc65bb881e718b1979298155d07b1ac94ef28

Contents?: true

Size: 334 Bytes

Versions: 2

Compression:

Stored size: 334 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module Mixture
  module Coerce
    # Handles coercion of the boolean classes.
    class Boolean < Base
      type Types::Boolean

      coerce_to(Types::Object, Itself)
      coerce_to(Types::Boolean, Itself)
      coerce_to(Types::Integer) { |value| value ? 1 : 0 }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mixture-0.7.1 lib/mixture/coerce/boolean.rb
mixture-0.7.0 lib/mixture/coerce/boolean.rb