Sha256: e57b94a1644619b3e3dee754ffc0589fbea7d65ad389647d51700909bd2f1702
Contents?: true
Size: 615 Bytes
Versions: 2
Compression:
Stored size: 615 Bytes
Contents
module TimecopConsole module MainHelper def time_travel_to(date) unless date.respond_to?(:year) && date.respond_to?(:month) && date.respond_to?(:day) raise ArgumentError, "Argument must be a Date object" end update_path = timecop_console.update_path(timecop: { 'current_time(1i)' => date.year, 'current_time(2i)' => date.month, 'current_time(3i)' => date.day, 'current_time(4i)' => 12, 'current_time(5i)' => 0 }) button_to(date.strftime("%B %d, %Y"), update_path, method: :post) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timecop-console-0.3.1 | app/helpers/timecop_console/main_helper.rb |
timecop-console-0.3.0 | app/helpers/timecop_console/main_helper.rb |