Class: ActiveRecord::Embedded::Field::Boolean

Inherits:
ActiveRecord::Embedded::Field show all
Defined in:
lib/active_record/embedded/field/boolean.rb

Overview

In Ruby, boolean values are represented as the singletons true and false, which are instances of TrueClass and FalseClass, respectively. JSON has no such distinction, boolean values can be either value or null.

Constant Summary

Constants inherited from ActiveRecord::Embedded::Field

PREFIX

Instance Attribute Summary

Attributes inherited from ActiveRecord::Embedded::Field

#default, #name

Instance Method Summary collapse

Methods inherited from ActiveRecord::Embedded::Field

#coerce, #default?, #default_method_name, find, #initialize, types

Constructor Details

This class inherits a constructor from ActiveRecord::Embedded::Field

Instance Method Details

#cast(value) ⇒ Object


11
12
13
# File 'lib/active_record/embedded/field/boolean.rb', line 11

def cast(value)
  !!value
end