mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Apply syntax_tree formatting to app/*
This commit is contained in:
@@ -31,7 +31,7 @@ class PluginStore
|
||||
end
|
||||
|
||||
def self.get_all(plugin_name, keys)
|
||||
rows = PluginStoreRow.where('plugin_name = ? AND key IN (?)', plugin_name, keys).to_a
|
||||
rows = PluginStoreRow.where("plugin_name = ? AND key IN (?)", plugin_name, keys).to_a
|
||||
|
||||
Hash[rows.map { |row| [row.key, cast_value(row.type_name, row.value)] }]
|
||||
end
|
||||
@@ -72,10 +72,14 @@ class PluginStore
|
||||
|
||||
def self.cast_value(type, value)
|
||||
case type
|
||||
when "Integer", "Fixnum" then value.to_i
|
||||
when "TrueClass", "FalseClass" then value == "true"
|
||||
when "JSON" then map_json(::JSON.parse(value))
|
||||
else value
|
||||
when "Integer", "Fixnum"
|
||||
value.to_i
|
||||
when "TrueClass", "FalseClass"
|
||||
value == "true"
|
||||
when "JSON"
|
||||
map_json(::JSON.parse(value))
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user