微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby – 如何使用octokit.rb获取提交日期

所以我可以使用以下命令从repo中获取提交:

commits = Octokit.commits(‘tansaku / gitimmersion’)

但我无法弄清楚如何获得提交的日期.如果我提交个人提交,我可以看到日期存在:

#<索耶::资源:0x007fb045935358
 @ _agent =< Sawyer :: Agent https://api.github.com/\u0026gt;,
 @_fields =#< Set:{:author,:committer,:message,:tree,:comment_count}>,
 @_Metaclass =#<班级:#<索耶::资源:0x007fb045935358>>中
 @_rels =#< Sawyer :: Relation :: Map:[:self]>,
 @ ATTRS =
  {:作者=>
    #<索耶::资源:0x007fb045932590
     @ _agent =< Sawyer :: Agent https://api.github.com/\u0026gt;,
     @_fields =#<设置:{:name,:email,:date}>,
     @_Metaclass =#<班级:#<索耶::资源:0x007fb045932590>>中
     @_rels =#< Sawyer :: Relation :: Map:[]>,
     @ ATTRS =
      {:name =>“Sam Joseph”,
       :电子邮件=> “中tansaku@gmail.com”,
       :date => 2014-03-10 14:35:53 UTC}>,
   :提交者=>
    #<索耶::资源:0x007fb0459302b8
     @ _agent =< Sawyer :: Agent https://api.github.com/\u0026gt;,
     @_Metaclass =#<班级:#<索耶::资源:0x007fb0459302b8>>中
     @_rels =#< Sawyer :: Relation :: Map:[]>,
   :message =>“使用命令行”,
   :树=>
    #<索耶::资源:0x007fb045927aa0
     @ _agent =< Sawyer :: Agent https://api.github.com/\u0026gt;,
     @_fields =#< Set:{:sha}>,
     @_Metaclass =#<班级:#<索耶::资源:0x007fb045927aa0>>中
     @_rels =#< Sawyer :: Relation :: Map:[:self]>,
     @attrs = {:SHA => “中11b345c2fc315b5f7ae6db2e0f6b0570780c20d1”}>中
   :COMMENT_COUNT =大于0}>

但我似乎无法从这些Sawyer对象中提取它们.

1.9.3-p392:043> pp提交[0] .author.date

 =>零

1.9.3-p392:047> pp提交[0] .committer.date

 =>零

现在显然我只是真的很蠢,但有人可以解释我如何从Sawyer对象中获取这些日期吗?

提前谢谢了
CHEERS> SAM

解决方法

这可以解决你的困境吗?

犯[0] .commit.author [:日期]   => 2014-03-10 14:35:53 UTC    犯[0] .commit.committer [:日期]   => 2014-03-10 14:35:53 UTC

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐