Return of the Beer.new
Beer.drinkable
Yes that’s right, last month when I was visiting the Sydney Ruby on Rails monthly meetup I was introduced to the Beer model, not the type of model your thinking about, something more along the lines of:
class Beer < ActiveRecord::Base CAT_PISS = 2 named_scope :drinkable, :conditions => ['quality > ?', CAT_PISS] # ... end Beer.drinkable #=> [#<Beer id: 25, name: "Tooheys New", quality: 4, rating: 7.1, best_served: "cold">, #<Beer id: 17, name: "Corona", quality: 7, rating: 9.0, best_served: "cold with lime" >]
(Its a Rails thing)
If ‘beer’ == cold
then ‘drink’
else ‘put in fridge’
EndIf
If ‘beer’ == case > 1
then BAAAADDD!!
else fail…
EndIf
Syntactically speaking, your code is quite wrong.