changing in order to meet new demands
changing to meet new demands
a project that is difficult
| class Survivor | |
| attr_accessor :contestants, :teams | |
| def initialize | |
| @contestants = [] | |
| @teams = [] | |
| end | |
| # return the losing team | |
| def challenge |
| puts "Shawty what yo name is?" | |
| n = gets.chomp.split(" ").join("") | |
| l = n.length | |
| puts "No it ain't. It's #{n[0]}#{l-2}#{n[l-1]}" |
As if diversity wasn't enough a problem.
Git's default master branch
| class Batman | |
| def intro | |
| puts "*"*80 | |
| puts "Welcome to Batman: Arkham Asylum" | |
| puts "*"*80 | |
| end | |
| def ask_question(question, options) | |
| puts "*"*80, question, "*"*80 |
| class SharkTank | |
| attr_reader :sharks, :entrepreneur | |
| def initialize | |
| @sharks = [] | |
| end | |
| def add_shark(shark) | |
| @sharks << shark | |
| end |
| uppers = "A".."Z" | |
| lowers = "a".."z" | |
| letters = uppers.to_a + lowers.to_a | |
| numbers = ("0".."9") | |
| #### | |
| ## 1st question | |
| #### | |
| all_letters = false |
| # display a line on the screen | |
| # | |
| # refactoring to | |
| # - remove some Ruby jargon by defining a | |
| # domain-specific-language (DSL) | |
| # - remove some repetitive (copy-pasted) code | |
| # - have a single place to change the line width | |
| def put_a_line | |
| puts "*" * 50 | |
| end |