Class: ActiveModel::Type::Binary
- Inherits:
-
Value
show all
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb
Overview
Defined Under Namespace
Classes: Data
Instance Attribute Summary
Attributes inherited from Value
#limit, #precision, #scale
Instance Method Summary
collapse
Methods inherited from Value
#==, #assert_valid_value, #changed?, #deserialize, #force_equality?, #hash, #initialize, #map, #serializable?, #type_cast_for_schema, #value_constructed_by_mass_assignment?
Instance Method Details
10
11
12
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 10
def binary?
true
end
|
#cast(value) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 14
def cast(value)
if value.is_a?(Data)
value.to_s
else
super
end
end
|
#changed_in_place?(raw_old_value, value) ⇒ Boolean
27
28
29
30
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 27
def changed_in_place?(raw_old_value, value)
old_value = deserialize(raw_old_value)
old_value != value
end
|
#serialize(value) ⇒ Object
22
23
24
25
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 22
def serialize(value)
return if value.nil?
Data.new(super)
end
|
6
7
8
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/type/binary.rb', line 6
def type
:binary
end
|