As if diversity wasn't enough a problem.
Git's default master branch
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 |
require 'rspec/autorun' | |
# A Set is an Array that is automatically de-duplicated (uniq'd) | |
require 'set' | |
#### | |
## Coordinate | |
## | |
## an x,y coordinate pair |
module AlphabetTesters | |
# self methods | |
# activated on require | |
# must be called with namespace | |
# e.g. AlphabetTesters.a? | |
def self.a?(letter) | |
letter.downcase == "a" | |
end | |
def self.b?(letter) |