Skip to content

Instantly share code, notes, and snippets.

@ecuageo
Created May 14, 2015 15:15
Show Gist options
  • Save ecuageo/7f7b12b2b03acb49d5ab to your computer and use it in GitHub Desktop.
Save ecuageo/7f7b12b2b03acb49d5ab to your computer and use it in GitHub Desktop.
use builtin conversion protocols 3
class Meals
def initialize
@breakfeast = "Cereal"
@lunch = "Sandwich"
@dinner = "Steamed Veggies"
end
def yield_meals
yield @breakfeast
yield @lunch
yield @dinner
end
end
meals = Meals.new
meals_array = []
meals.yield_meals {|ym| meals_array << ym}
puts meals_array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment