Module: Html2rss::Config::Schema::DeepStringifier
- Defined in:
- lib/html2rss/config/schema.rb
Overview
Converts nested hash keys to strings so the resulting schema serializes cleanly.
Class Method Summary collapse
Class Method Details
.call(object) ⇒ Object
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/html2rss/config/schema.rb', line 191 def call(object) case object when Hash stringify_hash(object) when Array object.map { |value| call(value) } else object end end |
.stringify_hash(object) ⇒ Object
202 203 204 |
# File 'lib/html2rss/config/schema.rb', line 202 def stringify_hash(object) object.to_h { |key, value| [key.to_s, call(value)] } end |