module Helpers
Public Instance Methods
compute_day_range_from_start_end(s,e)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 23 def compute_day_range_from_start_end(s,e) all_days = [] s = Date.parse(s) e = Date.parse(e) i = s while (i <= e ) all_days << i i += 1.day end all_days.map{|d| time_format_str_small(d)} end
earliest_for(whatevers)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 13 def earliest_for(whatevers) whatevers = whatevers.map{|s| Date.parse(s) } if whatevers.first.is_a?(String) time_format_str(whatevers.sort.first) end
latest_for(whatevers)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 18 def latest_for(whatevers) whatevers = whatevers.map{|s| Date.parse(s) } if whatevers.first.is_a?(String) time_format_str(whatevers.sort.last) end
remove_trailing_x(str)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 35 def remove_trailing_x(str) str.gsub(/[xX]$/,"") end
time_format_str(whatever)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 5 def time_format_str(whatever) Date.parse(whatever.to_s).strftime("%Y-%m-%dT%H:%M:%SZ") end
time_format_str_small(whatever)
click to toggle source
# File lib/gem_velocity/helpers.rb, line 9 def time_format_str_small(whatever) Date.parse(whatever.to_s).strftime("%Y-%m-%d") end