Sha256: ac852ccf4868ec655d33b7d55a539020a50141b14b1309fda678e48e25014d37
Contents?: true
Size: 611 Bytes
Versions: 3
Compression:
Stored size: 611 Bytes
Contents
class TopBeers::Style attr_accessor :beers attr_reader :name @@all = [] def initialize(name) @beers = [] @name = name @@all << self end def self.find_or_create_by_name(name) style = @@all.detect {|b| b.name.downcase == name.downcase} if style.nil? style = self.new(name) end style end def show_beers puts "\n"+"-"*"#{@name}".length puts "#{@name}" puts "-"*"#{@name}".length @beers.each.with_index(1) do |beer, i| puts "#{i}. #{beer.name} - #{beer.brewery.name}" end end def self.all @@all.sort_by! {|e| e.name} end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
top-beers-cli-app-0.1.5 | lib/top-beers/style.rb |
top-beers-cli-app-0.1.4 | lib/top-beers/style.rb |
top-beers-cli-app-0.1.3 | lib/top-beers/style.rb |