因此,我可以使用以下命令从repo中获取提交:commits = Octokit.commits('tansaku/gitimmersion')
但我不知道怎么确定犯罪日期。如果我申请个人提交,我可以看到日期:#<Sawyer::Resource:0x007fb045935358 @_agent=<Sawyer::Agent https://api.github.com/>, @_fields=#<Set: {:author, :committer, :message, :tree, :comment_count}>, @_metaclass=#<Class:#<Sawyer::Resource:0x007fb045935358>>, @_rels=#<Sawyer::Relation::Map: [:self]>, @attrs= {:author=> #<Sawyer::Resource:0x007fb045932590 @_agent=<Sawyer::Agent https://api.github.com/>, @_fields=#<Set: {:name, :email, :date}>, @_metaclass=#<Class:#<Sawyer::Resource:0x007fb045932590>>, @_rels=#<Sawyer::Relation::Map: []>, @attrs= {:name=>"Sam Joseph", :email=>"[email protected]", :date=>2014-03-10 14:35:53 UTC}>, :committer=> #<Sawyer::Resource:0x007fb0459302b8 @_agent=<Sawyer::Agent https://api.github.com/>, @_fields=#<Set: {:name, :email, :date}>, @_metaclass=#<Class:#<Sawyer::Resource:0x007fb0459302b8>>, @_rels=#<Sawyer::Relation::Map: []>, @attrs= {:name=>"Sam Joseph", :email=>"[email protected]", :date=>2014-03-10 14:35:53 UTC}>, :message=>"using command lines", :tree=> #<Sawyer::Resource:0x007fb045927aa0 @_agent=<Sawyer::Agent https://api.github.com/>, @_fields=#<Set: {:sha}>, @_metaclass=#<Class:#<Sawyer::Resource:0x007fb045927aa0>>, @_rels=#<Sawyer::Relation::Map: [:self]>, @attrs={:sha=>"11b345c2fc315b5f7ae6db2e0f6b0570780c20d1"}>, :comment_count=>0}>
但我似乎无法从这些锯工的东西中提取出来。1.9.3-p392 :043 > pp commits[0].author.datenil => nil
1.9.3-p392 :047 > pp commits[0].committer.datenil => nil
很明显我真的很蠢,但是有人能解释一下我怎么能从索耶的东西里得到这些日期吗?
多谢提前
喝彩>山姆
最佳答案
这能解决你的困境吗?commits[0].commit.author[:date]
=> 2014-03-10 14:35:53 UTC
commits[0].commit.committer[:date]
=> 2014-03-10 14:35:53 UTC