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

Would it be possible to extend happymapper to accept a function for transforming element names into tagnames? #54

Open
deiga opened this issue Sep 5, 2014 · 1 comment
Labels

Comments

@deiga
Copy link

deiga commented Sep 5, 2014

I dislike having to type too much and transformation form snake_case to PascalCase just doesn't seem too sensible (element :mime_type, String, :tag => 'MimeType'). Would it be possible to just add an attribute that takes a set of params (ie. what case to transform into) or a block/proc to handle the transformation?

Examples:

  • element :mime_type, String, :tag_format => :pascal
  • element :mime_type, String, :tag => Proc.new { |name| return "%f %s" % [5, name] }
@mvz
Copy link
Owner

mvz commented Dec 31, 2017

Perhaps a simple solution is to allow automatic transformation in the opposite direction:

element String, tag: 'MimeType'

This would automatically underscore-ize the tag name, similar to the existing HappyMapper.parse method.

@mvz mvz added the feature label Dec 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants