加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-17 02:22:16 所属栏目:百科 来源:网络整理
导读:所以我可以使用以下命令从repo中获取提交: commits = Octokit.commits(‘tansaku / gitimmersion’) 但我无法弄清楚如何获得提交的日期.如果我提交个人提交,我可以看到日期存在: #索耶::资源:0x007fb045935358 ?@ _agent = Sawyer :: Agent https://api.g
所以我可以使用以下命令从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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读