최근 집에서 구성한 구성 모듈을 Configatron으로 대체했지만 최근 유스 케이스를 사용할 수 없습니다.Object.const_get에 대한 매개 변수로 값을 사용할 때 Configatron :: Store를 String으로 변환 할 수 없습니다.
나는이 같은 Object.const_get하는 인수로 configatron 값을 사용하려고 할 때 :
이def formatter_class
Object.const_get(configatron.formatter)
end
나는 다음과 같은 오류를 얻을 : (
file.rb:10:in `const_get': can't convert Configatron::Store to String
(Configatron::Store#to_str gives Configatron::Store) (TypeError)
configatron 할당은 다음과 같습니다 단순화) :
configatron.formatter = case
when condition?
'ExportFormat'
else
'ScreenFormat'
end
내가 configatron.formatter = 'ScreenFormat'
일지라도 오류.
formatter_class
방법에 대한 변형도 시도해 보았습니다. 물론
def formatter_class
Object.const_get(configatron['formatter'])
end
,이 작업이 성공,하지만 내 사용 사례 이행하지 않습니다 :이 실패
def formatter_class
Object.const_get('ScreenFormat')
end
내가 잘못하고있는 중이 야 무엇을?