Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created November 17, 2011 18:37
Show Gist options
  • Save joegaudet/1374027 to your computer and use it in GitHub Desktop.
Save joegaudet/1374027 to your computer and use it in GitHub Desktop.
def self.is_date(key)
define_method(key) do
Date.parse(instance_variable_get("@#{key}"))
end
define_method("#{m}=") do |val|
instance_variable_set("@#{m}",val.string.strftime('%a %d %b, %l:%m %P'))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment