Fix nil error when used together with kicker #51

Merged
merged 1 commit into from Jul 24, 2012

Conversation

Projects
None yet
3 participants
Contributor

rolftimmermans commented Jul 13, 2012

When using spin together with kicker as advertised in the README, the following error may happen:

spin:237:in `initialize': can't convert nil into String (TypeError)

This change fixes an in-place map! operation so that the subsequent compact and uniq actually have an effect. This strips nil arguments that are the result of passing empty strings to spin on the command line.

+1.

This fixes the compatibility problem with test/unit + spin + kicker described in issue #50

Owner

jstorimer commented Jul 23, 2012

Fixed by #57.

jstorimer closed this Jul 23, 2012

Contributor

rolftimmermans commented Jul 23, 2012

Well, I guess that patch fixes some scenarios, but compact!.uniq! does not always do what you might think it does:

a = [1,2,2]
a.compact!.uniq!
#=> NoMethodError: undefined method `uniq!' for nil:NilClass

a = [1,2,2,nil]
a.compact!.uniq!
#=> [1,2]

This pull request does not suffer from that problem.

jstorimer reopened this Jul 24, 2012

@jstorimer jstorimer added a commit that referenced this pull request Jul 24, 2012

@jstorimer jstorimer Merge pull request #51 from rolftimmermans/fix_argv
Fix nil error when used together with kicker
c3f1d86

@jstorimer jstorimer merged commit c3f1d86 into jstorimer:master Jul 24, 2012

Owner

jstorimer commented Jul 24, 2012

Thanks for clearing that up, I've always found the in-place Enumerable methods do not behave according to my expectations.

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