Sha256: 97ceba91accd479e7b61740163e119eae8bcc6041dc475ae823bdc7d514d3951

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

module GoogleBook
  class Book < Struct.new :images,
                          :info,
                          :preview,
                          :creator,
                          :date,
                          :description,
                          :format,
                          :identifier,
                          :publisher,
                          :subject,
                          :title

    def initialize(args={})
      args.each { |k, v| self.send "#{k}=", v }
    end

    def isbn
      @isbn ||= find_isbn
    end

    private

    def find_isbn
      identifier.detect { |i| i.match(/ISBN:([0-9]{13})/) }
      $1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
googlebook-0.1.1 lib/googlebook/book.rb
googlebook-0.1.0 lib/googlebook/book.rb