Skip to content

Instantly share code, notes, and snippets.

@mybuddymichael
Created December 6, 2012 18:23
Show Gist options
  • Save mybuddymichael/4226779 to your computer and use it in GitHub Desktop.
Save mybuddymichael/4226779 to your computer and use it in GitHub Desktop.
# Public: Get one of the class's time properties with the correct time
# but also including the timezone.
#
# Returns a DateTime object.
[:last_sync_time, :last_parse_time, :last_connect_time].each do |attribute|
define_method(attribute) do
convert_to_timezone_without_changing_time(read_attribute(attribute),
read_attribute(:timezone))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment