Description
I find the api to add_tab very strange. Why is there such a huge diffence between hashes and arrays?
The current codes looks like
def add_tab(name, value)
return if name.nil?
if value.is_a? Hash
meta_data[name] ||= {}
meta_data[name].merge! value
else
meta_data["custom"] = {} unless meta_data["custom"]
meta_data["custom"][name.to_s] = value
end
end
I suggest
def add_tab(name, value)
return if name.nil?
meta_data[name.to_sym] ||= {}
meta_data[name].merge!(value.is_a? Hash ? value : {name.to_sym => value})
end
I was very confused when I added one tab called details and it appeared in the web view as CUSTOM.
It's not realy a issue since I will just wrap slimiar to what I did in my changes. I can open a PR if you are interested in the chang. I think it makes the api more unifor, therefor betterm. On the other hand it chages the behavour so someone might be supprces if it changes.
Description
I find the api to add_tab very strange. Why is there such a huge diffence between hashes and arrays?
The current codes looks like
I suggest
I was very confused when I added one tab called
detailsand it appeared in the web view asCUSTOM.It's not realy a issue since I will just wrap slimiar to what I did in my changes. I can open a PR if you are interested in the chang. I think it makes the api more unifor, therefor betterm. On the other hand it chages the behavour so someone might be supprces if it changes.