From 63c683fdf9f8d629116a28b9e8439b7e2269c265 Mon Sep 17 00:00:00 2001 From: Chris Colvard Date: Thu, 19 May 2016 15:11:18 -0400 Subject: [PATCH] Try casting start and end time into Floats but fall back to actual value --- lib/active_annotations/rdf_annotation.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/active_annotations/rdf_annotation.rb b/lib/active_annotations/rdf_annotation.rb index 78cfe98..9766b0c 100644 --- a/lib/active_annotations/rdf_annotation.rb +++ b/lib/active_annotations/rdf_annotation.rb @@ -142,7 +142,9 @@ def fragment_value=(value) def start_time value = fragment_value.nil? ? nil : fragment_value.object.value.scan(/^t=(.*)$/).flatten.first.split(/,/)[0] - value.nil? ? nil : value.to_f + Float(value) + rescue + value end def start_time=(value) @@ -151,7 +153,9 @@ def start_time=(value) def end_time value = fragment_value.nil? ? nil : fragment_value.object.value.scan(/^t=(.*)$/).flatten.first.split(/,/)[1] - value.nil? ? nil : value.to_f + Float(value) + rescue + value end def end_time=(value)