我在厨师资源中有以下属性:
attribute :attribName, kind_of: String, name_attribute: true, default: 'big string sldkjslkdflksdksdlkff'
我想打破它,让它看起来不错,所以我这样做了:
attribute [
:attribName,
kind_of: String,
name_attribute: true,
default: 'big string sldkjslkdflksdksdlkff'
]
但是在收敛时出现错误:
NoMethodError
-------------
undefined method `to_sym' for #<Array:0x00000004a63b60>
Did you mean? to_s
to_yaml
to_set
Platform:
---------
x64-mingw32
Running handlers:
[2016-10-01T19:07:39-07:00] ERROR: Running exception handlers
Running handlers complete
[2016-10-01T19:07:39-07:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 11 seconds
[2016-10-01T19:07:39-07:00] FATAL: Stacktrace dumped to C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2016-10-01T19:07:39-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-10-01T19:07:39-07:00] FATAL: NoMethodError: undefined method `to_sym' for #<Array:0x00000004a63b60>
Did you mean? to_s
to_yaml
to_set
所以我认为attribute
资源文件中的 s 只是接受一组参数并将 [..args..] 传递给它的方法。为什么这不起作用?我想我对在这种情况下什么类型的 ruby 对象属性以及它们的行为感到困惑。