This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Television | |
def initialize(manufacturor, size, resolution = nil, flatscreen? = false) | |
@manufacturor = manufacturor | |
@size = size | |
if resolution.nil? | |
@resolution = 'not sure' | |
else | |
@resolution = resolution | |
end | |
if flatscreen? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
personal_information = [] | |
salutations = [ | |
'Mr.', | |
'Mrs.', | |
'Mr.', | |
'Dr.', | |
'Ms.' | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Whiteboard | |
attr_accessor :contents | |
def initialize(contents = []) | |
@contents = contents | |
end | |
def erase | |
@contents = [] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def emote | |
[ | |
'make various noises' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car | |
class << self | |
@@make_table = {} | |
def add_make(make_model) | |
make_model.each do |key, value| | |
@@make_table[key] = value | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
failures=[] | |
lows=[] | |
mids=[] | |
highs=[] | |
CSV.foreach('test.csv', headers: true) do |row| | |
score = row[1].to_f | |
if score < 70 | |
fails = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teams =[] | |
def no_dups?(teams) | |
names=[] | |
teams.each do |team| | |
if names.include?(team['team_name']) | |
return false | |
else | |
names << team['team_name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teams =[] | |
def no_dups?(teams) | |
names=[] | |
teams.each do |team| | |
if names.include?(team['team_name']) | |
return false | |
else | |
names << team['team_name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teams =[] | |
def no_dups?(teams) | |
names=[] | |
teams.each do |team| | |
if names.include?(team['team_name']) | |
return false | |
else | |
names << team['team_name'] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
every_game=[] | |
teams =[] | |
game = 0 | |
winner = nil | |
def no_dups?(teams) | |
names=[] | |
teams.each do |team| | |
if names.include?(team['team_name']) | |
return false |