module RailsSunset::Controller
Protected Instance Methods
normalize_datetime(datetime)
click to toggle source
# File lib/rails_sunset/controller.rb, line 40 def normalize_datetime(datetime) datetime = DateTime.parse(datetime) if datetime.is_a? String datetime = datetime.to_datetime if datetime.respond_to? :to_datetime return datetime if datetime.respond_to? :httpdate raise TypeError, 'The date should be a Date, DateTime, Time or string containing a valid date and time' end
normalize_link(link, _params)
click to toggle source
# File lib/rails_sunset/controller.rb, line 47 def normalize_link(link, _params) link = instance_exec(&(link)) if link.respond_to? :call return if link.nil? return link if link.is_a? String raise TypeError, 'The link should be a string, or a lambda that returns a string' end