Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change behavour of add_tab #587

Open
stoivo opened this issue Mar 24, 2020 · 2 comments
Open

Change behavour of add_tab #587

stoivo opened this issue Mar 24, 2020 · 2 comments
Labels
feature request Request for a new feature

Comments

@stoivo
Copy link
Contributor

stoivo commented Mar 24, 2020

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.

@mattdyoung
Copy link

Hi @stoivo

Thanks for the feedback. We likely wouldn't accept a PR with your proposed suggestion at present due like you say to issues with other customers who may rely on the current behavior.

We plan to revisit this interface in the future and try to come up with a more consistent way of handling arrays being added to tabs though.

Thanks!

@mattdyoung mattdyoung added the feature request Request for a new feature label Mar 30, 2020
@stoivo
Copy link
Contributor Author

stoivo commented Mar 30, 2020

Ok, not supprized. Stability is defenetly imprtant in a bug tracking software. Thansks for a good product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants