Sha256: e06dc6c644987adf4e8c575c06c91ebd2b758c3a58a1f5d51819cfe055ebcfde

Contents?: true

Size: 328 Bytes

Versions: 6

Compression:

Stored size: 328 Bytes

Contents

# frozen_string_literal: true

using SmartCore::Ext::BasicObjectAsObject

# @api public
# @since 0.1.0
# @version 0.3.0
SmartCore::Types::Value.define_type(:Boolean) do |type|
  type.define_checker do |value|
    value.is_a?(::TrueClass) || value.is_a?(::FalseClass)
  end

  type.define_caster do |value|
    !!value
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
smart_types-0.8.0 lib/smart_core/types/value/boolean.rb
smart_types-0.7.1 lib/smart_core/types/value/boolean.rb
smart_types-0.7.0 lib/smart_core/types/value/boolean.rb
smart_types-0.6.0 lib/smart_core/types/value/boolean.rb
smart_types-0.4.0 lib/smart_core/types/value/boolean.rb
smart_types-0.3.0 lib/smart_core/types/value/boolean.rb