Skip to content

Question about .valid? method #15

@jbutton

Description

@jbutton

Hello.
I think the ".valid?" method is not accurate.
as I can see it's only checking simple regexp isbn.match(/^[0-9]{13}$/) and checksum

It doesn't work well for many ISBNs, for example 8830114722800 - it is mark as valid but it is not:

https://isbnsearch.org/search?s=8830114722800

For now I can use workaround:
if lisbn.parts.nil? && lisbn.parts(4).nil?
then it is invalid.

I would like to look around for proper ISBN validation rules, and use it in ".valid?" method. I will do the research.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions