ruby 1.9 上的砂砾警告
我正在学习grit(版本2.4.1)。这是我的基本代码:
#!/usr/bin/env ruby -wKU
require "grit"
repo = Grit::Repo.new("./myproject")
p repo.commits
运行此代码给了我很多警告。正如用户 @Dogbert 所指出的,此 GitHub diff 提供了帮助我删除了其中一些,现在我只得到以下内容:
更新
更改hunk = hunk.map { |block|让块 }
进入 hunk = hunk.map { |blk| yield block }
位于 diff-lcs (v1.1.2) 的第 266 行和第 303 行)删除了这两个警告:
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:266: warning: shadowing outer local variable - block
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:303: warning: shadowing outer local variable - block
更新 2
正如用户 @injekt 所说 此处 process.rb 将在下一个版本中删除。这将消除:
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:289: warning: method redefined; discarding old spawn
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:221: warning: previous definition of spawn was here
UPDATE 3
THX to user @DogBert...
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs/hunk.rb:69: warning: method redefined; discarding old flag_context=
...通过将 hunk.rb 的第 68 行从 :attr_accessor
更改为 来消失:attr_reader
inside diff-lcs gem
现在我有一个“stackoverflow meta”问题: 这个问题与我有什么关系?
I'm learning grit (version 2.4.1). Here is my basic code:
#!/usr/bin/env ruby -wKU
require "grit"
repo = Grit::Repo.new("./myproject")
p repo.commits
Running this code gave me a lot of warnings. This GitHub diff, as pointed out by user @Dogbert, helped me removing some of them and now I get the only the following:
UPDATE
changing hunk = hunk.map { |block| yield block }
into hunk = hunk.map { |blk| yield block }
both at lines 266 and 303 of diff-lcs (v1.1.2) removed this two warnings:
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:266: warning: shadowing outer local variable - block
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs.rb:303: warning: shadowing outer local variable - block
UPDATE 2
As user @injekt says here process.rb will be removed in the next release. This will get rid of:
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:289: warning: method redefined; discarding old spawn
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/grit-2.4.1/lib/grit/process.rb:221: warning: previous definition of spawn was here
UPDATE 3
THX to user @DogBert...
/Users/mircospino/.rvm/gems/ruby-1.9.2-p180/gems/diff-lcs-1.1.2/lib/diff/lcs/hunk.rb:69: warning: method redefined; discarding old flag_context=
...Disappeared by changing line 68 of hunk.rb, from :attr_accessor
to :attr_reader
inside the diff-lcs gem
Now I have a "stackoverflow meta" question:
what I have to do with this question?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法通过以下方式删除警告:
This GitHub diff, thx @DogBert
更改了 hunk = hunk.map { |block|让块 } 进入
hunk = hunk.map { |blk| diff-lcs (v1.1.2) 第 266 行和第 303 行的yield block }
正如用户 @injekt 所说,
process.rb
将在下一个版本中删除。这将消除此警告:正如用户 @DogBert 所说,将 hunk.rb 的第 68 行从
:attr_accessor
更改为 diff-lcs gem 内的:attr_reader
删除警告:方法重新定义;丢弃旧的 flag_context=...
I managed to remove the warnings by:
This GitHub diff, thx to @DogBert
changed
hunk = hunk.map { |block| yield block }
intohunk = hunk.map { |blk| yield block }
both at lines 266 and 303 of diff-lcs (v1.1.2)As user @injekt says here
process.rb
will be removed in the next release. This will get rid of this warnings:As user @DogBert said changing line 68 of hunk.rb, from
:attr_accessor
to:attr_reader
inside the diff-lcs gem removedwarning: method redefined; discarding old flag_context=...