Sha256: d0febe1b44594b4ae7857c566ed88a3947529adf688d0b3b766a9e828dcd22a7

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 Bytes

Contents

class TopBeers::Beer
  attr_accessor :name, :style, :abv, :brewery, :url, :ba_score, :availability, :description

  @@all = []

  def initialize(name)
    @name = name
    @@all << self
  end

  def self.all
    @@all
  end

  def style=(style)
    @style = TopBeers::Style.find_or_create_by_name(style)
    @style.beers << self
  end

  def brewery=(brewery)
    @brewery = TopBeers::Brewery.find_or_create_by_name(brewery)
    @brewery.beers << self
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
top-beers-cli-app-0.1.5 lib/top-beers/beer.rb
top-beers-cli-app-0.1.4 lib/top-beers/beer.rb
top-beers-cli-app-0.1.3 lib/top-beers/beer.rb