Ruby 2.3: time_zone.rb:272: 警告:循环参数引用 - 现在
Ruby 2.3: time_zone.rb:272: warning: circular argument reference - now
作为升级 Dockerfile 的一部分,我正在尝试制作一个特定的 gem 运行,其中包含大约 8 年前编写的指南。
我发现我必须为它使用 Ruby <= 2.3 因为在它上面它给出了无穷无尽的语法错误很可能是因为一些 major changes in 2.4.
我正在用 rvm 安装 Ruby 2.3.8:
# Install libssl-1.0 from 'stretch' repositories (needed for ruby 2.3)
RUN echo "deb http://deb.debian.org/debian/ stretch main contrib non-free" > /etc/apt/sources.list.d/libssl-legacy.lenter code hereist \
&& echo "deb-src http://deb.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list.d/libssl-legacy.list \
&& echo "APT::Default-Release "bullseye";" > /etc/apt/apt.conf.d/libssl-legacy \
&& apt update && apt install -y libssl1.0-dev
# Install Ruby 2.3 with RVM (to /usr/local/rvm/rubies/ruby-2.3.8/bin/ruby)
ENV PATH="/usr/local/rvm/bin:$PATH"
ENV rvm_path="/usr/local/rvm"
RUN curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - \
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - \
&& curl -sSL https://get.rvm.io | bash \
&& rvm install 2.3
几天前,我设法毫无问题地构建了这个指南,但我现在似乎无法让它工作。我错过了什么?
我在尝试使用 'guides build' 构建 gem 时遇到以下错误:
/usr/local/rvm/gems/ruby-2.3.8/gems/activesupport3.0.20/lib/active_support/values/time_zone.rb:272: warning: circular argument reference - now
指向time_zone.rb中的这个函数:
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from parsed string. Example:
#
# Time.zone = "Hawaii" # => "Hawaii"
# Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If upper components are missing from the string, they are supplied from TimeZone#now:
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
def parse(str, now=now)
date_parts = Date._parse(str)
return if date_parts.blank?
time = Time.parse(str, now) rescue DateTime.parse(str)
if date_parts[:offset].nil?
ActiveSupport::TimeWithZone.new(nil, self, time)
else
time.in_time_zone(self)
end
end
ruby-v:
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]
gem-v:
3.3.10
捆绑器-v:
Bundler version 2.3.10
def parse(str, now=now) <- 这是你的问题。
您现在正在尝试将其设置为自身。循环参数引用意味着变量正在寻找自己。
/active_support/values/time_zone.rb:272:: warning: circular argument reference
作为升级 Dockerfile 的一部分,我正在尝试制作一个特定的 gem 运行,其中包含大约 8 年前编写的指南。
我发现我必须为它使用 Ruby <= 2.3 因为在它上面它给出了无穷无尽的语法错误很可能是因为一些 major changes in 2.4.
我正在用 rvm 安装 Ruby 2.3.8:
# Install libssl-1.0 from 'stretch' repositories (needed for ruby 2.3)
RUN echo "deb http://deb.debian.org/debian/ stretch main contrib non-free" > /etc/apt/sources.list.d/libssl-legacy.lenter code hereist \
&& echo "deb-src http://deb.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list.d/libssl-legacy.list \
&& echo "APT::Default-Release "bullseye";" > /etc/apt/apt.conf.d/libssl-legacy \
&& apt update && apt install -y libssl1.0-dev
# Install Ruby 2.3 with RVM (to /usr/local/rvm/rubies/ruby-2.3.8/bin/ruby)
ENV PATH="/usr/local/rvm/bin:$PATH"
ENV rvm_path="/usr/local/rvm"
RUN curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - \
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - \
&& curl -sSL https://get.rvm.io | bash \
&& rvm install 2.3
几天前,我设法毫无问题地构建了这个指南,但我现在似乎无法让它工作。我错过了什么?
我在尝试使用 'guides build' 构建 gem 时遇到以下错误:
/usr/local/rvm/gems/ruby-2.3.8/gems/activesupport3.0.20/lib/active_support/values/time_zone.rb:272: warning: circular argument reference - now
指向time_zone.rb中的这个函数:
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from parsed string. Example:
#
# Time.zone = "Hawaii" # => "Hawaii"
# Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If upper components are missing from the string, they are supplied from TimeZone#now:
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
def parse(str, now=now)
date_parts = Date._parse(str)
return if date_parts.blank?
time = Time.parse(str, now) rescue DateTime.parse(str)
if date_parts[:offset].nil?
ActiveSupport::TimeWithZone.new(nil, self, time)
else
time.in_time_zone(self)
end
end
ruby-v:
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]
gem-v:
3.3.10
捆绑器-v:
Bundler version 2.3.10
def parse(str, now=now) <- 这是你的问题。
您现在正在尝试将其设置为自身。循环参数引用意味着变量正在寻找自己。
/active_support/values/time_zone.rb:272:: warning: circular argument reference