Skip to content

Transforming inputs? #483

@vlad-pisanov

Description

@vlad-pisanov

First, thanks for maintaining this gem, I love it! 🎉

I like that we can do things like string :name, strip: true which transforms the input by stripping it.

I think it would be useful to be able to define an arbitrary transformation lambda when the input is defined.
For example, this would snap all time inputs to the beginning of the day, and force variable names into the proper format:

time :start, transform: -> (t) { t.beginning_of_day }
string :var, transform: -> (s) { s.camelcase }

This would certainly DRY up a lot of our code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions