从ruby中的UUID v1中提取时间
我已经存储了UUID v1作为密钥的数据,现在我想知道何时生成UUID。 我怎么做那个好方法?
这适用于irb:
require 'simple_uuid' uuid = SimpleUUID::UUID.new uuid.to_guid # actually this is what I have stored in my database Time.at(SimpleUUID::UUID.new(uuid.to_guid).seconds) # returns the time and date of the UUID
感谢我的朋友KillerFox,他向我展示了简单的解决方案。
- 三元运算符
- 是否一直在迭代一个恒定的最佳实践?
- Rails 4设计3.1.1 ActionController :: Devise中的UnknownFormat :: RegistrationsController #new
- 在ruby中,对于以问号结尾的方法名称,是否是真实的惯用语?
- 如何让一行以|结尾 (管道)在HAML?
- rails – 如何使用祖先制作嵌套路由
- 模拟RSpecunit testing中的竞争条件
- Ajax with Polymorphic Association(Destroy&Create)
- 如果referer =“/ search”,请执行X,否则执行Y:“错误的参数(预期的URI对象或URI字符串)”