lib/rasti/form.rb in rasti-form-2.0.0 vs lib/rasti/form.rb in rasti-form-2.1.0

- old
+ new

@@ -153,9 +153,13 @@ value = fetch attribute assert attribute, value.is_a?(String) ? !value.strip.empty? : !value.empty?, 'is empty' end end + def assert_time_range(attribute_from, attribute_to) + assert attribute_from, public_send(attribute_from) <= public_send(attribute_to), 'invalid time range' + end + def assert_included_in(attribute, set) if assert_present attribute assert attribute, set.include?(fetch(attribute)), "not included in #{set.map { |e| e.is_a?(::String) ? "'#{e}'" : e.inspect }.join(', ')}" end end \ No newline at end of file