Sha256: 63f3e51ba570759018aca44472598badedc1156353b4a2a5870d602482647aef

Contents?: true

Size: 404 Bytes

Versions: 3

Compression:

Stored size: 404 Bytes

Contents

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

    @@all = []

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

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

    def self.all
        @@all
    end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libri-0.2.4 lib/libri/books.rb
libri-0.2.3 lib/libri/books.rb
libri-0.2.2 lib/libri/books.rb