Support for empty values in yesno filter #71

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant
@gar1t
Contributor

gar1t commented Apr 29, 2013

The previous implementation was over specified and didn't support empty
strings as yesno options.

This implementation uses binary:split/3, which is as efficient as
string:tokens/2 but returns empty tokens.

See https://github.com/gar1t/erlang-bench/blob/master/comma-parse.escript for
details on parsing implementations.

This commit removes the odd conversion of Bool to a list, which was never
used in yesno_io.

This change returns a binary value, which may be contrary to the spirit
of the template implementation. If this is the case, the the result can be
easily converted to a list (a seeming waste of cycles, but perhaps there's
a good reason for it).

Support for empty values in yesno filter
The previous implementation was over specified and didn't support empty
strings as yesno options.

This implementation uses binary:split/3, which is as efficient as
string:tokens/2 but returns empty tokens.

See https://github.com/gar1t/erlang-bench/blob/master/comma-parse.escript for
details on parsing implementations.

This commit removes the odd conversion of Bool to a list, which was never
used in yesno_io.

This change returns a *binary* value, which may be contrary to the spirit
of the template implementation. If this is the case, the the result can be
easily converted to a list (a seeming waste of cycles, but perhaps there's
a good reason for it).

@gar1t gar1t closed this Apr 29, 2013

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