Module: ActiveModel::Type::Helpers::AcceptsMultiparameterTime::InstanceMethods

Defined in:
activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb

Instance Method Summary collapse

Instance Method Details

#assert_valid_value(value) ⇒ Object



24
25
26
27
28
29
30
# File 'activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb', line 24

def assert_valid_value(value)
  if value.is_a?(Hash)
    value_from_multiparameter_assignment(value)
  else
    super(value)
  end
end

#cast(value) ⇒ Object



16
17
18
19
20
21
22
# File 'activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb', line 16

def cast(value)
  if value.is_a?(Hash)
    value_from_multiparameter_assignment(value)
  else
    super(value)
  end
end

#serialize(value) ⇒ Object



8
9
10
# File 'activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb', line 8

def serialize(value)
  serialize_cast_value(cast(value))
end

#serialize_cast_value(value) ⇒ Object



12
13
14
# File 'activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb', line 12

def serialize_cast_value(value)
  value
end

#value_constructed_by_mass_assignment?(value) ⇒ Boolean

Returns:



32
33
34
# File 'activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb', line 32

def value_constructed_by_mass_assignment?(value)
  value.is_a?(Hash)
end