Closed parkr closed 3 years ago
@parkr Do we really need to have that respond_to?(:encode)
check?
Can't we cast and proceed right away?
attributes.map { |k, v| "#{k}=#{v.to_s.encode(:xml => :attr)}" }.join(" ")
No worries at all 😄
@jekyllbot: merge +dev
Fixes https://github.com/jekyll/jekyll-feed/issues/325.
The jekyll-github-metadata plugin, for example, sets
site.title
andsite.name
toJekyll::GitHubMetadata::Value
objects which respond to#to_s
and#to_liquid
, but NOT#encode
. Therefore, we should cast to a string if#encode
is not yet available.The reason we cast to a string is because the previous code was
"#{k}=#{v}"
, which was implicitly casting to a string forv
.