我想在课堂上使用cattr_accessor
fromactive_support/core_ext/class/attribute_accessors
refinement
require 'active_support/core_ext/class/attribute_accessors'
module ExtendedString
refine String do
cattr_accessor :separator
end
end
但我得到了错误:
block in <module:ExtendedString>': undefined method `cattr_accessor' for #<refinement:String@Truncator::ExtendedString> (NoMethodError)
我如何cattr_accessor
在课堂精炼中使用?