Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-26 02:50:28 +01:00
Add key recursion to wizard field interpolation
Dieser Commit ist enthalten in:
Ursprung
b41d66214a
Commit
b634bed1d0
1 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
|
@ -53,7 +53,13 @@ class CustomWizard::Builder
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
result = result.gsub(/w\{(.*?)\}/) { |match| data[$1.to_sym] }
|
result.gsub(/w\{(.*?)\}/) { |match| recurse(data, [*$1.split('.')]) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.recurse(data, keys)
|
||||||
|
k = keys.shift
|
||||||
|
result = data[k]
|
||||||
|
keys.empty? ? result : self.recurse(result, keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build(build_opts = {}, params = {})
|
def build(build_opts = {}, params = {})
|
||||||
|
|
Laden …
In neuem Issue referenzieren