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

Humanize Custom Attribute #272

Closed
mdmoura opened this issue May 22, 2014 · 4 comments · Fixed by #277
Closed

Humanize Custom Attribute #272

mdmoura opened this issue May 22, 2014 · 4 comments · Fixed by #277

Comments

@mdmoura
Copy link

mdmoura commented May 22, 2014

Hello,

I have an attribute, Info, in an third party library with two fields: Text and Slug.

The attribute applied to an enum becomes:

[Info("Business", "business")] 

It is possible to create some kind of rule to humanize custom attributes such as this?

Thank You,
Miguel

@MehdiK
Copy link
Member

MehdiK commented May 22, 2014

If your attribute has a string Description property it will be used for the enum member. You can find the code here and more info here.

@mdmoura
Copy link
Author

mdmoura commented May 22, 2014

Yes, I read the information you mention ...
But this enum does not have a Description property and it is from an external library.

I wonder if an extension point couldn't be added to Humanize to create custom humanize rules, for example, for this case.

On application startup there could be a humanize settings which would add custom rules for each project ...

Wouldn't this be a good option and make it flexible for many scenarios?

@MehdiK
Copy link
Member

MehdiK commented May 23, 2014

I agree. I think it could be useful for some cases like yours. I'll flag it as an enhancement and we can tackle it in the future.

@MehdiK
Copy link
Member

MehdiK commented May 23, 2014

Well @mdmoura. There you go. @mexx to the rescue! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants