undefined method `at' for ProgressBar::Time:Class
harryloewen opened this issue · 3 comments
I ran into that nasty issue.
Quick fix could be:
/lib/progress_bar.rb:27 Time.at(0)
with ::Time.at(0)
yeah, looks like that one got missed. I'm still surprised by this, I wonder what that other Time
constant is coming from that's getting into scope in ProgressBar
.
If you're on Ruby 2.7, do you think you could help debug? 2.7 provides const_source_location, maybe you can show me the output of what you get with ProgressBar.const_source_location(:Time)
.
Here you are.
irb(main):002:0> ProgressBar.const_source_location(:Time)
=> ["/Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb", 3]
BTW: I would also prefer Time.zone.at
(or lets say rubocop prefers 😆)
Looks like you have another progressbar gem installed that's stomping on the namespace. https://github.com/jfelchner/ruby-progressbar/blob/master/lib/ruby-progressbar/time.rb
Time.zone
is a rails-ism, and isn't available in the Ruby stdlib. I don't want this gem to be Rails-only.