Skip to content

Conversation

@jelder
Copy link

@jelder jelder commented Oct 18, 2013

This adds a helper method to find valid ISBNs within blocks of text.

Lisbn.extract("Long form text mentioning several ISBNs including 978-0-07-352550-1") #=> ["978-0-07-352550-1"]

@ragalie
Copy link
Owner

ragalie commented Oct 18, 2013

I like this a lot, but why not make .extract an instance method? Since Lisbn subclasses from String it seems natural to pass in the string you're working on if you intend to do ISBN-related manipulations on it, then just use different methods if you know it's an ISBN or if you know there are ISBNs embedded in it.

Also, since .extract's behavior is basically a special case of #scan, maybe call it #scan_isbns and allow it to take a block as well?

What do you think? Thanks for the PR!

@jelder
Copy link
Author

jelder commented Oct 21, 2013

Good idea. I like this interface better, too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants