0

我正在尝试使用 Cmder CLI 在 Windows 10 上运行 Rails 应用程序。我在启动 rails 服务器时遇到错误。

C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.0.0/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.0.0/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.0.0/lib/active_support/core_ext/numeric/conversions.rb:138: warning: constant ::Fixnum is deprecated
*SIGUSR2 not implemented, signal based restart unavailable!
*SIGUSR1 not implemented, signal based restart unavailable!
*SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.4.0 (ruby 2.5.1-p57), codename: Owl Bowl Brawl
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop 2018-04-27 23:07:32 -0400: Rack app error: ArgumentError: wrong number of arguments (given 2, expected 0)>

请帮助我。


SAS 不允许%DO开放代码中的语句。当您提交一个开放的代码循环时,您将收到日志消息

ERROR: The %DO statement is not valid in open code.
...
ERROR: The %END statement is not valid in open code.

正如@Tom 提到的,宏%SCAN测试应该检查空字符串。另一种常见且更可靠的方法是在提取令牌之前进行检查。 %do %until当传递的分类为空时,迭代会很差。A在内部宏调用之前%do %while测试扫描。classification另一个对空宏值的常见测试是检查 0 长度并利用 0=false ^0=true 自动评估。

当循环要使用标记值调用其他宏时,最佳实践是传递标记值,而不是让被调用的宏在迭代宏调用之前假定标记符号(又名宏变量)已经存在(在包含范围内)。

例子

%macro mydispatch (classification=);

  %local index token;
  %let index = 1;
  %do %while ( %length (%scan (&classification, &index)));
    %let token = %scan(&classification,&index));

    %* emit code specifically for token;
    * this is for &token;

    %* iterated invocations, perform two analysis for each data set listed in classification;        
    %* second analysis is passed another argument specifying the data set that should be used to store output;
    %analysis_1 (data=&token)
    %analysis_2 (data=&token, out=WORK.results_&token.)

    %let index = %eval(&index+1);
  %end;
%mend mydispatch;

%mydispatch (classification=data1 data2 data3 data4)
4

1 回答 1

0

我找到了解决我自己问题的方法。据我了解,我的 Ruby 版本是 2.5.1,这还不是一个稳定的版本。

我只是通过再次安装 Rubyinstaller 来降级 Ruby 版本。该版本现在是 2.3.3,应用程序运行良好。

于 2018-05-01T17:35:01.060 回答