Module: ValidatesTimeliness::ActiveRecord
- Defined in:
- lib/validates_timeliness/active_record/attribute_methods.rb,
lib/validates_timeliness/active_record/multiparameter_attributes.rb
Defined Under Namespace
Modules: AttributeMethods, MultiparameterAttributes
Class Method Summary
collapse
Class Method Details
24
25
26
27
|
# File 'lib/validates_timeliness/active_record/multiparameter_attributes.rb', line 24
def (values)
year = ValidatesTimeliness::Formats.unambiguous_year(values[0].rjust(2, "0"))
[year, *values.slice(1, 2).map { |s| s.rjust(2, "0") }].join("-")
end
|
29
30
31
|
# File 'lib/validates_timeliness/active_record/multiparameter_attributes.rb', line 29
def (values)
values[3..5].map { |s| s.rjust(2, "0") }.join(":")
end
|
.time_array_to_string(values, type) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/validates_timeliness/active_record/multiparameter_attributes.rb', line 11
def time_array_to_string(values, type)
values.collect! {|v| v.to_s }
case type
when :date
(values)
when :time
(values)
when :datetime
(values) + " " + (values)
end
end
|