Sha256: 9a3604db61ef41d1a859c6e3f5130b47c22377d83ef0edd3a5f6dc6a07bed729

Contents?: true

Size: 402 Bytes

Versions: 4

Compression:

Stored size: 402 Bytes

Contents

class Libri::Books
    attr_accessor :title, :author, :url

    @@all = []

    def initialize(books_hash) 
        books_hash.map { |key, val|
            send "#{key}=", val
        }
        @@all << self
    end

    def self.create_from_collection(books_array)
        books_array.map { |books_hash|
            self.new(books_hash)
        }
    end

    def self.all
        @@all
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
libri-0.2.8 lib/libri/books.rb
libri-0.2.7 lib/libri/books.rb
libri-0.2.6 lib/libri/books.rb
libri-0.2.5 lib/libri/books.rb